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).
The mago format command is the entry point for all formatting-related tasks.
:::tip
For global options that can be used with any command, see the Command-Line Interface overview. Remember to specify global options before the format command.
:::
Usage: mago format [OPTIONS] [PATH]...
:::info
mago fmt is a convenient alias for mago format. Both can be used interchangeably.
:::
[PATH]...Optional. A list of specific files or directories to format. If you provide paths here, they will be used instead of the paths defined in your mago.toml configuration.
# Format a single file and a directory
mago fmt src/index.php tests/
| Flag, Alias(es) | Description |
|---|---|
--dry-run, -d |
Perform a "dry run". This will calculate and print a diff of all changes that would be made to your files without actually modifying them. |
--check, -c |
Check if the source files are formatted correctly. This is the ideal flag for CI environments. The command will exit with code 0 if all files are formatted, and 1 otherwise. |
--stdin-input, -i |
Read source code from stdin, format it, and print the result to stdout. This is useful for editor integrations. |
--staged, -s |
Format only files staged in git and re-stage them after formatting. Designed for pre-commit hooks. See the pre-commit hooks recipe for details. |
--help, -h |
Display help information about the mago format command. |
How can I help you explore Laravel packages today?