ramsey/coding-standard
ramsey/coding-standard provides Ramsey’s PHP_CodeSniffer ruleset to enforce consistent, modern PHP style across projects. Easy to install, integrates with CI, and helps catch formatting and code quality issues early with sensible defaults.
Install via Composer: composer require --dev ramsey/coding-standard. Run PHPCS directly with vendor/bin/phpcs — it auto-detects the included ruleset.xml and applies the ruleset to your project’s source files. For quick validation in a project root, run vendor/bin/phpcs src/. First-time users should run vendor/bin/phpcs --standard=vendor/ramsey/coding-standard/src/Ramsey explicitly to verify setup, or simply rely on auto-detection if placed in root (standard practice). The most immediate value is catching inconsistent spacing, missing type hints, or non-strict comparisons.
phpcs step in your workflow (e.g., GitHub Actions, GitLab CI) using vendor/bin/phpcs --standard=vendor/ramsey/coding-standard/src/Ramsey --error-severity=5 --warning-severity=5 src/ tests/. Fail builds on violations.git hooks to run phpcs --fix on staged files, automating formatting before commits.ramsey/coding-standard ruleset for live feedback.phpcs with --ignore-annotations and --extensions=php only, or exclude large sections via phpcs.xml while enabling strict checks incrementally.phpcs.xml to extend or narrow rules (e.g., disable Squiz.WhiteSpace.ScopeKeywordSpacing if your team prefers it relaxed).composer.json pins squizlabs/php_codesniffer explicitly if conflicting dev dependencies exist.--report-diff before auto-fixing.--standard Path Matters: If installing as a dependency (not root), don’t assume --standard=ramsey works; use full path (vendor/ramsey/coding-standard/src/Ramsey) or define custom phpcs.xml.phpcbf may reorder use statements or alter spacing in strings/comments — review diffs. Prefer phpcs --fix over phpcbf for granular control.ruleset.xml to add custom sniffs (e.g., PHPCompatibility) — the included file is intentionally minimal but modular.--warning-severity=0 is used; always test locally with --error-severity=1 --warning-severity=1 during adoption.How can I help you explore Laravel packages today?