Configuration Files
PsySH searches for configuration files in multiple locations, using the first one found:- Linux / macOS
- Windows
PsySH follows the XDG Base Directory specification:You can also use the older
rc.php filename instead of config.php.Local Project Configuration
PsySH supports project-specific configuration through a.psysh.php file in your current working directory:
.psysh.php
Local config files are subject to project trust settings. PsySH will prompt before loading untrusted project configs to prevent executing arbitrary code.
Configuration Methods
There are two ways to configure PsySH in your config file:1. Return an Array
The simplest method - return an associative array of options:config.php
2. Manipulate the Configuration Object
For more advanced configuration, manipulate the$config object directly:
config.php
Environment Variables
Several configuration options can be set via environment variables:Path to a custom config file
Control project trust behavior
always- Always trust project configsnever- Never trust project configs (Restricted Mode)prompt- Prompt before loading (default)
Command-Line Options
Many configuration options can be overridden at runtime:Configuration Priority
When the same option is configured in multiple places, PsySH uses this priority order (highest to lowest):- Command-line arguments - e.g.,
--color,-vvv - Environment variables - e.g.,
PSYSH_CONFIG - Local project config -
.psysh.phpin current directory - User config file -
~/.config/psysh/config.php - Default values - Built-in defaults
Config File Locations
Use thepaths command inside PsySH to see where it looks for files:
Next Steps
Configuration Options
Explore all available configuration options
Theme System
Customize colors and output appearance
Sample Config
Complete configuration file example