adamczykpiotr / laravel-ultimate-formatter
Ultimate code formatter for Laravel, taking care of everything
Package info
github.com/adamczykpiotr/laravel-ultimate-formatter
pkg:composer/adamczykpiotr/laravel-ultimate-formatter
Fund package maintenance!
Requires
- php: ^8.3
- barryvdh/laravel-ide-helper: ^3.8
- driftingly/rector-laravel: ^2.7
- fidry/cpu-core-counter: ^1.3
- friendsofphp/php-cs-fixer: ^3.64
- illuminate/contracts: ^12.0||^13.0
- illuminate/support: ^12.0||^13.0
- larastan/larastan: ^3.13
- phpat/phpat: ^0.12.5
- phpstan/phpstan: ^2.3
- rector/rector: ^2.8.2
- spatie/laravel-package-tools: ^1.16
- spaze/phpstan-disallowed-calls: ^4.15
- symfony/console: ^7.4||^8.0
- symfony/filesystem: ^7.4||^8.0
- symfony/process: ^7.4||^8.0
Requires (Dev)
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^11.0.0||^10.0.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.1
- phpunit/phpunit: ^11.0||^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v1.15.0
- v1.14.2
- v1.14.1
- v1.14.0
- v1.13.7
- v1.13.6
- v1.13.5
- v1.13.4
- v1.13.3
- v1.13.2
- v1.13.1
- v1.13.0
- v1.12.0
- v1.11.0
- v1.10.0
- v1.9.0
- v1.8.0
- v1.7.0
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.0
- v1.3.0
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- dev-refactor/architecture-followups
- dev-fix-53
- dev-fix-55
- dev-ci-prevent-formating-changes
- dev-fix/ruleset-docs-url
- dev-docs/split-readme
- dev-address-arch
- dev-fix-issue-20
- dev-fix-issue-18
- dev-feat/formatter-ignore
- dev-refactor/dogfood-phpstan-ruleset
- dev-fix/check-quiet-ruleset
- dev-fix/check-requires-phpstan-ruleset
- dev-fix/migrate-config-legacy-and-auto-hook
- dev-feat/custom-phpstan-rules
- dev-feat/config-migrator
- dev-fix/trait-docblocks-and-rector-verbosity
- dev-feat/issue-21-custom-style-rules
- dev-feat/more-rector-and-fixer-rules
- dev-feat/output-verbosity
- dev-feat/ide-helper-dependency
- dev-feat/phpstan-ruleset
- dev-fix/normalize-method-docblock-idempotency
- dev-feat/import-global-classes
- dev-ci/major-version-action-refs
- dev-ci/drop-laravel-11
- dev-feat/package-install-gaps
- dev-docs/performance
- dev-ci/align-php-version
- dev-perf/php-cs-fixer-all-cores
- dev-fix/enforce-lf-line-endings
- dev-chore/bump-phpstan-rector
- dev-feat/before-hooks
- dev-ci/semantic-release
- dev-feat/formatting-tooling
- dev-chore/align-base-with-dag-workflows
This package is auto-updated.
Last update: 2026-11-15 19:36:18 UTC
README
Ultimate code formatter for Laravel, taking care of everything: one package that ships Rector and PHP CS Fixer with a shared, opinionated configuration, so every project formats its code the same way. A PHPStan ruleset reports what the formatters can't fix: banned calls and architecture rules.
Installation
composer require --dev adamczykpiotr/laravel-ultimate-formatter vendor/bin/ultimate-formatter install
Supports Laravel 12–13 on PHP 8.3+.
install detects whether the project is an application or a package and publishes .php-cs-fixer.php,
rector.php, phpstan.neon and .git-blame-ignore-revs, plus config/ultimate-formatter.php in an
application. Existing files are skipped unless you pass --force, and --ci adds a GitHub Actions
workflow. See Setup for the paths it picks and how to add the ruleset to an existing
PHPStan config, and Adopting it in an existing project for the first run on a
large codebase.
Usage
vendor/bin/ultimate-formatter format # Rector, then PHP CS Fixer vendor/bin/ultimate-formatter check # dry run of both, then PHPStan; stops at the first failure (CI)
check runs PHPStan only when the project has a phpstan.neon, phpstan.neon.dist or phpstan.dist.neon.
Before anything else it asks PHPStan whether that config loads the PHPStan ruleset,
and fails with the includes to add when it doesn't, since the ruleset's rules would silently never run.
Pass --without-phpstan-ruleset to run PHPStan without it.
format --models regenerates model docblocks with laravel-ide-helper first, which is installed with the package. In a Laravel app the
same commands are available as php artisan formatter:install, formatter:format and
formatter:check.
| Flag | Effect |
|---|---|
-q |
Silences every step, so only the exit code reports the result |
-v, -vv |
Prints each command before it runs and passes the same level to each step |
-vvv |
As above, and passes --debug to Rector, which has no other verbosity flags |
These flags replace any --quiet or -v in the configured arguments.
What it enforces
- PHP CS Fixer: strict types, next-line braces, ordered imports and docblock tags, one sorted trait statement.
- Rector: type declarations, Laravel sets,
match, arrow functions, Carbon, and debug calls removed. - Custom rules: grouped numeric literals,
=== false/=== nullinstead of!, interpolation, earlycontinueguards, and more. - PHPStan ruleset: banned calls, class naming and architecture rules, and migration conventions.
Documentation
- Setup: layout detection, published files, PHPStan and Larastan, CI
- Adopting it in an existing project: the first format, blame, and getting PHPStan to pass
- Configuration: tool arguments, formatter rules, pre steps, ruleset flags, performance
- Upgrading: how
migrate-configkeeps your published config current - Formatting rules: everything
formatrewrites - PHPStan ruleset: every rule the ruleset reports, with its identifier
Changelog
See CHANGELOG for what changed in each release.
Contributing
See CONTRIBUTING for running the tests and how releases work.
License
The MIT License (MIT). Please see License File for more information.