- How do I install and apply this coding standard in a Laravel project?
- Run `composer require sunrise/coding-standard`, then reference its `ruleset.xml` in your `phpcs.xml` file. Specify paths like `<file>src</file>` and `<file>tests</file>` to target your project directories. No additional Laravel-specific setup is required.
- Does this package support Laravel’s Blade template files or Eloquent conventions?
- No, this package focuses on PSR-1/PSR-2 for PHP code only. For Blade templates or Eloquent-specific rules, you’ll need to extend the ruleset manually or use Laravel’s default Pint/PHP-CS-Fixer configurations.
- Will this work with PHP 8.x or Laravel 10+?
- The package hasn’t been updated since 2019, so it may not fully support PHP 8.x features like named arguments or match expressions. Test it in your Laravel 10+ project first—you might need to fork and update rules for compatibility.
- Can I use this alongside Laravel’s default Pint or PHP-CS-Fixer?
- Yes, but conflicts may arise if rules differ (e.g., line length, brace positioning). Use `--rules` in PHP-CS-Fixer to include this ruleset or merge configurations in `phpcs.xml` to layer standards without duplication.
- How do I integrate this into GitHub Actions for CI/CD?
- Add a step to your workflow using PHP-CS-Fixer with the ruleset path: `vendor/bin/php-cs-fixer fix --rules=./vendor/sunrise/coding-standard/ruleset.xml --dry-run`. For PHP_CodeSniffer, run `vendor/bin/phpcs --standard=./vendor/sunrise/coding-standard/ruleset.xml src tests`.
- Is this package actively maintained? What if I find a bug?
- The package is unmaintained (last release in 2019). Report issues on GitHub, but expect community-driven fixes. For critical needs, fork the repo and extend it to add Laravel-specific rules or PHP 8.x support.
- Does this replace Laravel’s built-in Pint or PHP-CS-Fixer rules?
- No, it supplements PSR-1/PSR-2 standards. Compare its output with Laravel’s defaults (e.g., `vendor/bin/php-cs-fixer fix`) to identify gaps. Use it as a baseline or layer it with existing tools via custom ruleset composition.
- How do I customize or extend this ruleset for Laravel-specific needs?
- Fork the repository and modify `ruleset.xml` to add Laravel-specific rules (e.g., Facade naming, Blade indentation). Override or exclude default rules in your `phpcs.xml` to tailor it to your project’s needs.
- Are there alternatives for Laravel that include Blade/Eloquent support?
- Yes, consider `laravel-pint` (Laravel’s official formatter) or `dealerdirect/phpcodesniffer-composer-plugin` for PSR-compliant rules. For Blade-specific checks, tools like `phpstan/extension-installer` or custom PHPCS rules may be needed.
- How do I test this ruleset before full adoption in my project?
- Run it against a subset of files first: `vendor/bin/phpcs --standard=./vendor/sunrise/coding-standard/ruleset.xml src/ --warning-severity=0`. Compare results with Laravel’s default standards to spot conflicts, then pilot it in CI with `--dry-run` before full integration.