- What is sinemacula/coding-standards-laravel used for?
- It is a Laravel-specific coding standards package that bundles PHP_CodeSniffer configurations and code-quality tooling presets. Teams use it to enforce consistent style, catch issues early, and keep Laravel repositories clean with minimal setup. It is designed as a shared baseline for Laravel projects rather than a runtime framework package.
- How do I install sinemacula/coding-standards-laravel?
- Install it through Composer, typically as a development dependency using composer require --dev sinemacula/coding-standards-laravel. Then reference the package ruleset from your project's phpcs.xml or equivalent PHP_CodeSniffer configuration. Check the README for the exact ruleset name and any optional setup steps.
- Does this package work with Laravel 10 and Laravel 11?
- The package targets Laravel projects and provides coding standards and static-analysis presets rather than framework runtime code. Exact Laravel version constraints should be confirmed in its composer.json because the provided excerpt does not list them. PHP_CodeSniffer rulesets are often version-agnostic, but verify compatibility before upgrading Laravel.
- How do I run the coding standards check on my Laravel project?
- After installation, run PHP_CodeSniffer from your project root, usually via vendor/bin/phpcs with your configured ruleset. You can target app, routes, tests, or the entire project depending on what your phpcs.xml includes. Using the package preset keeps results consistent across Laravel repositories.
- Can I use this package alongside Laravel Pint or PHP-CS-Fixer?
- This package is built around PHP_CodeSniffer, so it is separate from formatters like Laravel Pint and PHP-CS-Fixer. You can use them together, but avoid letting multiple tools fight over the same formatting rules. Decide which tool owns formatting and which owns standards enforcement to keep local and CI results predictable.
- How do I customize the ruleset for my Laravel project?
- Create or edit your project's phpcs.xml to include the package ruleset, then add exclusions or rule overrides for paths and sniffs that do not fit your codebase. Keeping customizations in your project config is safer than editing vendor files because it survives Composer updates. Review the documented ruleset names and available sniffs before overriding behavior.
- Is this package suitable for CI pipelines?
- Yes, PHP_CodeSniffer-based standards are commonly run in CI to fail builds when style violations are found. Add the check as a Composer script or CI step and cache Composer dependencies for faster runs. Pin the package through composer.lock so local and CI results stay aligned.
- What static-analysis tools does it include?
- The package description says it bundles static-analysis rules and code-quality tooling presets, but the README excerpt does not enumerate specific tools. Check the README and composer.json for exact dependencies and available presets. It is intended as a shared baseline, not a replacement for project-specific analysis.
- How do I exclude generated files or legacy code from the standards check?
- In PHP_CodeSniffer, use exclude-pattern in your phpcs.xml to skip paths such as storage, vendor, or generated files. You can also limit the paths passed to phpcs so only app and tests are checked. Document exclusions so they remain intentional and get reviewed over time.
- What are alternatives to sinemacula/coding-standards-laravel?
- Alternatives include Laravel Pint, PHP-CS-Fixer, and custom PHP_CodeSniffer rulesets such as Symfony or Slevomat standards. The right choice depends on whether you need Laravel-specific sniffs, static-analysis presets, or mainly formatting. This package fits teams that want a ready-made shared Laravel baseline.