-
Notifications
You must be signed in to change notification settings - Fork 310
Configuration
While PsySH strives to detect the right settings automatically, you might want to fine-tune the configuration yourself. Add a file to ~/.config/psysh/config.php
(or C:\Users\{USER}\AppData\Roaming\PsySH\config.php
on Windows).
<?php
return [
'commands' => [
new \Psy\Command\ParseCommand,
],
'defaultIncludes' => [
__DIR__ . '/include/bootstrap.php',
],
'startupMessage' => sprintf('<info>%s</info>', shell_exec('uptime')),
];
See the full list of configuration options and a sample config file for further explanation of the available options.
When PsySH starts, it checks for a per-project .psysh.php
config file in the current directory. Both the global and the local config files are used if they exist, with global config.php
being loaded first.
Pass --config PATH
when launching PsySH to use a custom config file path. You can specify your config file location in the PSYSH_CONFIG
environment variable as well.
PsySH config files are PHP, so you can do pretty much anything you want in there.
Add something like this to the top of your PsySH config.
// Automatically autoload Composer dependencies
if (is_file(getcwd() . '/vendor/autoload.php')) {
require_once getcwd() . '/vendor/autoload.php';
}
This shouldnโt be necessary if youโve installed PsySH as a Composer dependency (or dev dependency) for your project. It will already be using the Composer autoloader in that case.
Support overriding php.ini
directives by dropping a .php.ini
file in the current directory.
// Support per-project `php.ini` directive overrides
if (is_file(getcwd() . '/.php.ini')) {
$conf = parse_ini_file(getcwd() . '/.php.ini');
foreach ($conf as $key => $val) {
ini_set($key, $val);
}
}