carthage-software/mago
Mago is an extremely fast PHP linter, formatter, and static analyzer written in Rust. It brings Rust-inspired speed and reliability to PHP projects with a modern toolchain and great developer experience, plus multiple install options (script, Homebrew, Composer).
Mago's behavior can be configured using several environment variables. These variables can be used to override settings defined in the mago.toml configuration file.
MAGO_LOGSets the logging level for Mago. This is useful for debugging issues or getting more detailed output.
trace, debug, info, warn, errorMAGO_LOG=trace mago lintNO_COLORIf this variable is set to any value (e.g., 1, true), it disables all colored output from Mago.
NO_COLOR=1 mago lintSee no-color.org for more information.
FORCE_COLORIf this variable is set to any non-empty value (e.g., 1, true), it forces colored output from Mago, even when the output is not a terminal (e.g., when piping to a file or another command).
This takes precedence over NO_COLOR.
FORCE_COLOR=1 mago lint | less -RSee force-color.org for more information.
XDG_CONFIG_HOMEMago follows the XDG Base Directory Specification. When no configuration file is found in the workspace, Mago searches for a global configuration file in the following order:
$XDG_CONFIG_HOME/mago.toml — if XDG_CONFIG_HOME is set$HOME/.config/mago.toml — the default XDG config directory$HOME/mago.toml — the user's home directorySet this variable to change the first lookup directory:
XDG_CONFIG_HOME=/path/to/config mago lintMAGO_ prefixThe MAGO_ prefix is reserved for Mago configuration. Mago reads all environment variables starting with MAGO_ and attempts to map them to configuration fields. If any MAGO_-prefixed environment variable does not correspond to a valid configuration field, Mago will fail with an "unknown field" error.
For example, setting MAGO_LINT=1 or MAGO_MY_CUSTOM_VAR=foo in your environment will cause an error like:
ERROR Failed to build the configuration: unknown field `lint`, expected one of ...
If you encounter unexpected configuration errors, check your environment for any MAGO_-prefixed variables that are not listed below:
env | grep ^MAGO_
Remove or rename any variables that are not recognized by Mago.
The following environment variables can be used to override settings from the mago.toml file.
MAGO_PHP_VERSIONOverrides the php_version setting. This is useful for testing your code against different PHP versions without modifying the configuration file.
MAGO_PHP_VERSION=8.2 mago lintMAGO_THREADSOverrides the threads setting, allowing you to control the number of parallel threads Mago uses for tasks like linting and formatting.
MAGO_THREADS=4 mago lintMAGO_EDITOR_URLOverrides the editor-url setting and the auto-detected editor URL. This takes the highest precedence for determining clickable file path URLs in diagnostic output.
See Editor Integration for supported URL templates.
MAGO_EDITOR_URL="phpstorm://open?file=%file%&line=%line%&column=%column%" mago lintMAGO_ALLOW_UNSUPPORTED_PHP_VERSIONOverrides the allow-unsupported-php-version setting. Set to true to allow Mago to run on unsupported PHP versions. This is not recommended and may lead to unexpected behavior.
MAGO_ALLOW_UNSUPPORTED_PHP_VERSION=true mago lintHow can I help you explore Laravel packages today?