Weave 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
Laravel Phpcs

Laravel Phpcs Laravel Package

mreduar/laravel-phpcs

Laravel PHPCS brings an opinionated PHP CodeSniffer ruleset and handy Artisan commands to your Laravel project, making it easy to lint code and auto-fix style issues so teams can enforce consistent coding standards and catch problems early.

View on GitHub
Deep Wiki
Context7

PHP Codesniffer ruleset to follow Laravel's coding style

Frequently asked questions about Laravel Phpcs
What is mreduar/laravel-phpcs and what does it do?
mreduar/laravel-phpcs is a development-time PHP_CodeSniffer ruleset that encodes Laravel's coding style, plus Artisan commands for linting and auto-fixing. It is not a runtime library and does not touch your application's request, queue, or database layers. Think of it as a checked-in lint configuration distributed through Composer, intended for CI quality gates and IDE integration.
How do I install laravel-phpcs in a Laravel project?
Install it as a dev dependency with Composer, typically by running composer require --dev mreduar/laravel-phpcs. Because PHPCS standards are discovered through dealerdirect/phpcodesniffer-composer-installer, you must allow that plugin under Composer 2.2 and later. After installation, confirm the ruleset is registered and run a dry run against your codebase before adding it to CI.
Do I need to allow the dealerdirect Composer plugin for laravel-phpcs?
Yes, in most Composer 2.2+ setups you need an allow-plugins entry for dealerdirect/phpcodesniffer-composer-installer. Without that opt-in, PHP_CodeSniffer may not discover the installed standard automatically. This is an easy onboarding step to forget, so document it in your project setup notes or commit the Composer config change.
Does laravel-phpcs support Laravel 10, 11, or 12?
The package is a dev-only ruleset with no runtime coupling, so it is not tied to a specific Laravel release in the way a service-provider package would be. The practical constraint is its 2022-era release and its dependency on the older squizlabs/php_codesniffer package lineage. Test it against your Laravel and PHP versions rather than assuming compatibility with the newest framework releases.
How do I run PHPCS and auto-fix style issues with Artisan commands?
The package ships Artisan commands that wrap PHP_CodeSniffer so you can lint and auto-fix from the command line. Exact command signatures can vary by release, so check the README for your installed version before scripting them in CI. For a safe first pass, run a report-only command, review the violations, and then use the fix command on a branch.
Can I use laravel-phpcs together with Laravel Pint?
You can install both, but running two auto-fixers creates conflicting formatting opinions and developer churn. Pint is PHP-CS-Fixer based, while this package is PHP_CodeSniffer based, so their fixes will not always agree. Pick one source of truth for formatting, and only keep this package if you specifically need sniff-level enforcement that Pint cannot express.
Does laravel-phpcs work with PHP 8.2, PHP 8.3, and PHP 8.4?
The ruleset predates PHP 8.2, 8.3, and 8.4 validation, and it targets the older squizlabs/php_codesniffer era. That does not guarantee failure, but it raises the risk of false positives on modern syntax such as enums, readonly properties, attributes, and first-class callables. Run an actual dry run on your codebase and review the dependency pins before relying on it for newer PHP versions.
How do I configure or customize the laravel-phpcs ruleset?
Configuration is done through PHP_CodeSniffer XML, typically by extending the package ruleset in your project's phpcs.xml or ruleset.xml. You can exclude specific sniffs, adjust paths, and add exclusions for generated code or legacy directories. Because the package is configuration-shaped and MIT licensed, many teams vendor the ruleset into the repository and tailor it directly.
Is laravel-phpcs suitable for CI pipelines and production deployments?
It is suitable for CI as a development-only lint gate, not for production runtime. Keep it in require-dev, install with Composer's no-dev flag for deployments, and run PHPCS as a separate CI job that fails on violations. Cache Composer and PHPCS results where possible, and avoid running it in the same step as Pint or another auto-fixer.
Is laravel-phpcs actively maintained, and what are the alternatives?
The last release was in November 2022 and the project has a small community footprint, so treat it as a personal convenience ruleset rather than a community-governed standard. Alternatives include Laravel Pint for formatting, a plain PSR-12 PHP_CodeSniffer ruleset, or Slevomat Coding Standard sniffs. Given the MIT license and small surface area, the lowest-risk path is often to evaluate the rules, extract what your team wants, and vendor the configuration.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect