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
Coding Standard

Coding Standard Laravel Package

cline/coding-standard

Opinionated PHP-CS-Fixer + Rector presets for modern PHP 8.4+ projects. Enforces strict coding standards, naming conventions, and architecture rules, with custom fixers, PHPDoc wrapping, and optional legacy tag/header rules for incremental adoption.

View on GitHub
Deep Wiki
Context7

Opinionated PHP-CS-Fixer presets and custom fixers for modern PHP, with ready-to-use rule sets, a preconfigured finder, and architecture-focused rules.

Frequently asked questions about Coding Standard
How do I integrate cline/coding-standard into an existing Laravel project with PHP-CS-Fixer?
Replace your existing PHP-CS-Fixer configuration by adding `cline/coding-standard` to `require-dev` in `composer.json`, then update your `.php-cs-fixer.dist.php` to use the `Standard` preset. The package provides drop-in presets like `Standard`, `PHPDoc`, and `PHPUnit` that align with Laravel’s PSR-12 conventions. Run `composer require cline/coding-standard --dev` first, then configure the preset in your fixer file.
Does cline/coding-standard support Laravel-specific files like Blade templates or migrations?
No, the package does not natively support Laravel-specific files like Blade templates or migrations. You’ll need to manually exclude them in your `.php-cs-fixer.dist.php` using the `$finder->exclude()` method. For example, add `$finder->exclude('resources/views')->exclude('database/migrations')` to skip those files.
Will this package work with Laravel 8.x or older versions?
No, cline/coding-standard requires PHP 8.4+, which may conflict with Laravel 8.x or older projects. If you’re using a legacy Laravel version, consider sticking with the standard `friendsofphp/php-cs-fixer` or a forked version of this package that supports older PHP versions. The package is designed for modern PHP projects.
How do I customize the presets for Laravel-specific naming conventions (e.g., Facade or Eloquent methods)?
You can extend the presets by adding custom rules in your `.php-cs-fixer.dist.php`. For example, to enforce Facade naming conventions, add `$standard->addRule('@PSR12:class_name_case')` or create a custom fixer. The package also includes architecture-focused rules, but you may need to add Laravel-specific exceptions manually.
Does cline/coding-standard work with Laravel Pint?
Yes, it can coexist with Laravel Pint if configured to use shared rule sets. However, Pint is opinionated for Laravel, while this package enforces broader PHP standards. You can run both tools in CI/CD pipelines but may need to exclude overlapping rules to avoid conflicts. Check the package’s documentation for integration tips.
How do I handle legacy code that uses `@author` or `@version` tags in PHPDoc blocks?
The `Standard` preset removes `@author` and `@version` tags by default, but you can opt back in by explicitly adding the legacy fixers. In your `.php-cs-fixer.dist.php`, include `$standard->addRule('@Symfony:legacy_phpdoc_author')` and `$standard->addRule('@Symfony:legacy_phpdoc_version')` to preserve them. This allows incremental adoption.
Will this package slow down my CI/CD pipeline?
The package includes custom fixers that may introduce slight overhead, especially if not optimized. To mitigate this, run PHP-CS-Fixer in parallel using `--parallel` or exclude unnecessary files. Test performance in a staging environment before full deployment. The package is designed to be efficient but may require tuning for large codebases.
Are there alternatives to cline/coding-standard for Laravel projects?
Yes, alternatives include Laravel Pint (official Laravel formatter), `friendsofphp/php-cs-fixer` with custom rules, or `dealerdirect/phpcodesniffer-composer-installer` for PSR-12 compliance. Pint is Laravel-specific but less opinionated, while PHP-CS-Fixer offers more granular control. This package combines PHP-CS-Fixer and Rector for stricter standards and architecture rules.
How do I test the package before adopting it in production?
Start by running the fixer in a dry mode to preview changes: `./vendor/bin/php-cs-fixer fix --dry-run`. Compare output with your existing codebase using `git diff` or tools like `php-cs-fixer/diff`. Pilot the package in a non-critical Laravel module first, then gradually roll it out. Use the `php-cs-fixer/diff` package to generate CI-friendly reports.
Can I contribute Laravel-specific rules or fixers to this package?
Yes, contributions are welcome! Check the [CONTRIBUTING.md](https://github.com/cline/coding-standard/blob/main/CONTRIBUTING.md) guide for details. If you want to add Laravel-specific rules (e.g., for Facades or Eloquent), fork the repository and submit a pull request. The package is MIT-licensed, so modifications can be reused or extended.
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