Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Styler Laravel Package

pmjones/php-styler

PHP-Styler is a PHP 8.1 code formatter that fully rewrites formatting for consistent spacing, indentation, and line splitting. It preserves code logic and comments, aims for diff-friendly output, and supports customizable styles/rules for structural transformations.

View on GitHub
Deep Wiki
Context7

Reformats PHP code from scratch.

Frequently asked questions about Php Styler
Can PHP-Styler enforce PSR-12 standards in a Laravel project?
Yes, PHP-Styler supports configurable styles and rules to align with PSR-12. Use the `PSR12` preset or customize spacing, line length, and brace positioning in your config. Test with `--check` first to avoid unintended changes to Laravel’s existing codebase.
How does PHP-Styler handle Blade templates (.blade.php) in Laravel?
PHP-Styler processes PHP files only, so Blade templates won’t be reformatted automatically. Pre-process Blade files to extract PHP logic (e.g., with a custom script) or exclude them via config. For now, focus on core PHP files like controllers, service providers, and commands.
Will PHP-Styler break Laravel’s Artisan commands or CLI scripts?
It *could*—PHP-Styler’s aggressive reformatting may disrupt CLI scripts if they rely on specific formatting (e.g., `handle()` methods in commands). Run a preview (`php-styler apply --dry-run`) on `app/Console/Commands/` first. Exclude problematic files in your config if needed.
How do I integrate PHP-Styler into a Laravel CI/CD pipeline?
Use the `check` command in a GitHub Actions job to fail builds on formatting issues, then run `apply` in a separate job to auto-fix. Example: Add `vendor/bin/php-styler check` to your linting step, then use `git blame-ignore-revs` to suppress noise in post-merge commits.
Does PHP-Styler support incremental formatting (e.g., fix only trailing commas)?
No, PHP-Styler rewrites *all* formatting, unlike PHP-CS-Fixer. If you need granular fixes, use PHP-CS-Fixer alongside it or exclude specific files. For Laravel, this limits adoption to full-team buy-in or pre-commit hooks with strict config.
What Laravel versions and PHP versions does PHP-Styler support?
PHP-Styler requires **PHP 8.1+** and has no Laravel-specific dependencies, so it works with Laravel 9.x, 10.x, and 11.x. Test thoroughly with your Laravel version, as aggressive reformatting might affect legacy code (e.g., pre-PSR-12 projects).
How does PHP-Styler handle inline comments or docblocks in Laravel?
Block comments (e.g., `/* ... */`) and docblocks are preserved in place, but inline comments (especially multi-line) may shift. Laravel’s docblock-heavy files (e.g., `AppServiceProvider.php`) should be tested carefully. Use `--dry-run` to preview changes before full application.
Can I customize PHP-Styler’s formatting rules for my Laravel team?
Absolutely. Define custom `Styles`, `Rules`, and `Parses` in your config to match Laravel-specific conventions (e.g., brace positioning, line length). Start with the `PSR12` preset, then tweak for team preferences. Document your rules for consistency.
What’s the performance impact of PHP-Styler on large Laravel projects?
PHP-Styler supports parallel processing (`--workers`) to speed up formatting for large codebases (e.g., Laravel monorepos). For a 10,000+ file project, expect minutes, not hours. Benchmark with your CI pipeline to set realistic timeouts.
How does PHP-Styler compare to Laravel Pint (official formatter)?
PHP-Styler is more aggressive—it rewrites *all* formatting, while Pint focuses on incremental fixes. Pint is Laravel’s recommended tool for PSR-12 compliance, but PHP-Styler offers deeper customization for structural changes (e.g., brace expansion). Use Pint for maintenance, PHP-Styler for team-wide reformatting.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor