CLI
Every Laravel Fmt command, flag, and exit code.
vendor/bin/laravel-fmt [paths...] [flags]Path arguments
With no arguments, the whole project is formatted, except hidden and ignored files. Arguments can be files, directories, or globs:
vendor/bin/laravel-fmt app/Models/User.php
vendor/bin/laravel-fmt app resources/views
vendor/bin/laravel-fmt "resources/**/*.blade.php"Quote globs so they work the same on every platform. A glob that matches nothing is an error. A file
or folder that exists is never read as a glob, so a Folio [id].blade.php works.
--check
List the files that would change. Writes nothing.
vendor/bin/laravel-fmt --check--reporter
Write a report to stdout for CI. Requires --check. gitlab writes a GitLab Code Quality report.
See Continuous integration.
vendor/bin/laravel-fmt --check --reporter gitlab > gl-code-quality-report.json--diff
Show the changes as a diff. Writes nothing.
vendor/bin/laravel-fmt --diff--staged
Format staged changes and re-stage them. See Format on commit.
vendor/bin/laravel-fmt --staged--since
Format only files changed since a git ref.
vendor/bin/laravel-fmt --since main --check--config
Use a config file at a specific path.
vendor/bin/laravel-fmt --config build/laravel-fmt.json--no-config
Skip laravel-fmt.json. Settings from your existing config files still apply.
--show-config
Print the config used for a file as JSON. Formats nothing. Stderr shows which config file each layout setting comes from, and whether the file is ignored.
vendor/bin/laravel-fmt --show-config app/Models/User.php--stdin-filepath
Format stdin and write the result to stdout. The path picks the language and does not have to exist.
vendor/bin/laravel-fmt --stdin-filepath app/Models/User.php < input.php--range-start and --range-end
Only apply changes that overlap these byte offsets. Requires --stdin-filepath.
--color
auto (default), never, or always.
--version
Print the version, commit, and platform. -v for short.
Flag combinations
These are rejected:
--configwith--no-config--stagedwith--since,--check,--diff,--stdin-filepath, or paths--sincewith--stdin-filepathor paths--stdin-filepathwith--check,--diff, or paths--show-configwith anything that formats--reporterwith--diff
init
Write a laravel-fmt.json in the current directory, or in the app root when run inside a Laravel
app. It holds only the schema reference. Fails if one exists, unless you pass --force.
vendor/bin/laravel-fmt init
vendor/bin/laravel-fmt init --forcelsp
Start the language server. See Editors.
vendor/bin/laravel-fmt lspExit codes
| Code | Meaning |
|---|---|
0 |
Success |
1 |
--check or --diff found files to change |
2 |
An error: a file failed to parse, read, or write, or bad flags/paths |
The same codes as Prettier.