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).
Integrate Mago directly into the Zed editor for seamless, high-performance code formatting on save.
PATH configured: The mago executable must be in your system's $PATH. The recommended installation methods handle this automatically. You can verify this by running which mago in your terminal, which should return a path to the executable.Open Settings: Launch Zed and open your settings.json file. You can do this by pressing Cmd + , (on macOS) or Ctrl + , (on Linux/Windows) and then clicking "Open JSON Settings".
Add PHP Configuration: Add the following JSON block to your settings.json. If you already have a "languages" section, simply add the "PHP" object within it.
{
// ... other settings you may have
"languages": {
"PHP": {
// Recommended: Format your code automatically whenever you save a file.
"format_on_save": "on",
// Configure Mago as the external formatter.
"formatter": {
"external": {
"command": "mago",
"arguments": ["format", "--stdin-input"]
}
}
}
// ... other language settings
}
}
That's it! With this configuration, Zed will now automatically format your .php files with Mago every time you save.
You can also trigger formatting manually at any time by:
Cmd + Shift + P or Ctrl + Shift + P.How can I help you explore Laravel packages today?