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

Phpcsutils Laravel Package

phpcsstandards/phpcsutils

PHPCSUtils is a suite of utility functions for PHP_CodeSniffer, giving standard authors reliable, backward-compatible helpers for token handling, sniff testing, and cross-version support. Integrates via Composer or manually; PHP 5.4 to 8.5.

View on GitHub
Deep Wiki
Context7

A suite of utility functions for use with PHP_CodeSniffer

Frequently asked questions about Phpcsutils
What is PHPCSUtils used for?
PHPCSUtils is a utility library for PHP_CodeSniffer aimed at people who write or maintain sniffs. It provides backward-compatible token helpers, abstract sniff base classes, curated token groups, and a test harness so custom standards do not have to reach into PHPCS internals. Application code never calls it at runtime; it lives in your lint and CI layer. If you only run a third-party coding standard, it may arrive as a transitive dependency without you using it directly.
Does PHPCSUtils work with PHP_CodeSniffer 4?
Yes. PHPCSUtils backports newer PHPCS native utility functions so sniffs can target a single API across PHPCS 3.13.5 through 4.x. That compatibility layer is effectively the migration runway for PHPCS 4. Note that PHPCS 4 removes JS and CSS support, and PHPCSUtils will drop its incidental JS/CSS support when that lands, so teams linting JS/CSS through this path need a migration plan.
How do I install PHPCSUtils with Composer?
Run composer require --dev phpcsstandards/phpcsutils. The package pulls in the dealerdirect/phpcodesniffer-composer-installer plugin, which under Composer 2.2+ needs an explicit allow-plugins entry in composer.json. In locked-down environments that is a governance approval, not a code change; if the plugin is denied, the standard simply never registers. After install, PHPCS's native autoloader picks up sniffs without extra registration.
Do I need PHPCSUtils if I only use an existing coding standard?
Probably not directly. If you use a standard like PHPCompatibility or a framework standard that depends on PHPCSUtils, it comes in transitively and is invisible to you; the real decision is about the standard above it. Deliberately adopting PHPCSUtils matters when you author or maintain your own sniffs. A quick composer why phpcsstandards/phpcsutils will show whether it is already in your stack and at what version constraint.
Which PHP versions does PHPCSUtils support?
It supports PHP 5.4 as a minimum and is tested across PHP 5.4 through 8.5. That broad matrix is a confidence signal for teams on old or very new runtimes. It also means the maintainers carry a large compatibility burden, so pin versions in CI rather than floating on dev-develop.
How do I unit test custom PHPCS sniffs with PHPCSUtils?
PHPCSUtils ships UtilityMethodTestCase, which lets you run utility methods against fixture files inside PHPUnit. It works with PHPUnit 4.x through 11.x, so it fits both legacy and current test suites. You point it at test case files, set the target token, and assert the returned values. This keeps sniff tests independent of PHPCS internals and stable across PHPCS versions.
Can I install PHPCSUtils without Composer?
It is supported but fragile. Non-Composer setups rely on phpcs --config-set installed_paths, which overwrites previous values and must enumerate every standard you use. Each added standard turns into a coordination problem across machines and CI. Prefer Composer, or commit an explicit phpcs.xml ruleset path list to keep it reproducible.
Is the LGPL-3.0 license a problem for a dev-only dependency?
For a development-only tool that never ships in a runtime artifact, LGPL-3.0 is usually acceptable, but it still deserves a legal review before adoption. The obligations get more serious if you redistribute a bundled coding standard or embed sniffs in a distributed product. Get a written opinion if either applies; otherwise treat this as a gating review item rather than a blocker.
Will migrating my sniffs to PHPCSUtils change existing results?
Possibly, in edge cases. PHPCSUtils' improved versions of native PHPCS utility functions are not byte-for-byte identical to PHPCS behavior, so sniffs moved onto them can report different findings. Run your full fixture suite and compare results on a real codebase before and after the migration. Treat the change as a behavior-affecting refactor, not a drop-in swap.
Is PHPCSUtils actively maintained despite the low star count?
Yes. It is maintained under the PHPCSStandards organization with disciplined documentation, changelog, and releases, though it is a small-maintainer project with bus-factor risk. The 63-star and zero-declared-dependent figures understate adoption because it is a low-level transitive dependency that consumers rarely declare. Treat the low numbers as a prompt to inventory actual usage in your stack. Alternatives are limited: you can write sniffs directly against PHPCS internals, but you lose the cross-version compatibility layer.
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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator