imbo/imbo-coding-standard
PHP-CS-Fixer ruleset for Imbo and related PHP projects. Install as a dev dependency, add a .php-cs-fixer.dist.php config, and run php-cs-fixer check/fix locally or in GitHub Actions/Composer scripts to enforce consistent code style.
php-cs-fixer + this package), with no breaking changes to existing Laravel core or third-party packages.phpunit workflows).laravel-shift/php-coding-standard).php-cs-fixer fix --dry-run before full adoption.--parallel config.laravel-shift or custom PSR-12 overrides)?phpstan, psalm)?--parallel be configured per environment (local vs. CI)?laravel-shift or manual setup).laravel-shift/php-coding-standard, evaluate overlap before adoption.feature/coding-standards).composer require --dev imbo/imbo-coding-standard friendsofphp/php-cs-fixer..php-cs-fixer.dist.php and test with:
vendor/bin/php-cs-fixer fix --dry-run
$config->setRules([
'@Imbo' => true,
'phpcsrisky:risky' => false, // Example: Disable a rule
]);
laravel-shift) is already enforced.vendor/bin/php-cs-fixer fix --allow-risky=yes --diff
jobs:
coding-standards:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- run: composer install
- run: vendor/bin/php-cs-fixer fix --diff --dry-run
{
"scripts": {
"cs-check": "php-cs-fixer check --diff",
"cs-fix": "php-cs-fixer fix"
}
}
{
"husky": {
"hooks": {
"pre-commit": "composer cs-check"
}
}
}
imbo/imbo-coding-standard for new rules (e.g., PHP 8.3 compatibility).^3.0) to avoid breaking changes.$finder->exclude(['storage', 'tests/Feature/BrokenTest.php']);
--parallel or exclude large directories.--verbose flag for detailed output.CONTRIBUTING.md section for new devs.--path-mode=diff to only fix changed files in CI.bootstrap/cache):
$finder->exclude(['bootstrap/cache', 'vendor']);
$finder->in([__DIR__.'/packages/*']) to target specific paths.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| CI pipeline fails on violations | Blocks PR merges | Gradually enforce; allow exceptions for legacy code. |
| Rule conflicts with team standards | Developer frustration | Customize rules or negotiate with the team. |
| Performance slowdown in CI | Flaky builds | Exclude large files; use --parallel. |
| PHP version incompatibility | Build failures | Upgrade PHP or use a compatibility branch. |
CODE_STYLE.md with:
declare(strict_types=1)").composer cs-fix).// .editorconfig (optional, but recommended)
[*.php]
php_cs_fixer = vendor/bin/php-cs-fixer
array() vs `[]How can I help you explore Laravel packages today?