chameleon-system/code-style-config
Shared code style configuration for the Chameleon System PHP/Laravel ecosystem. Provides standardized formatting and linting rules (e.g., PHP-CS-Fixer/Pint setups) to keep multiple projects consistent, reduce review noise, and enforce team conventions.
Installation
composer require --dev chameleon-system/code-style-config
Add to composer.json under require-dev if not auto-detected.
First Use Case Integrate with PHP-CS-Fixer or PHPStan by extending their config files:
// php-cs-fixer.dist.php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/../src')
->exclude('vendor');
return (new PhpCsFixer\Config())
->setRules(include __DIR__.'/vendor/chameleon-system/code-style-config/php-cs-fixer/rules.php')
->setFinder($finder);
Where to Look First
vendor/chameleon-system/code-style-config/php-cs-fixer/rules.php for default rules.phpstan.neon.dist (if provided) for static analysis presets.Leverage as a Base Config Extend the package’s rules in your project’s config files:
// Custom rules.php
$rules = include __DIR__.'/vendor/chameleon-system/code-style-config/php-cs-fixer/rules.php';
$rules['array_syntax'] = ['syntax' => 'short']; // Override specific rules
CI/CD Pipeline Add to GitHub Actions (example):
- name: Run PHP-CS-Fixer
run: vendor/bin/php-cs-fixer fix --rules-set=chameleon --dry-run
IDE Integration
php-cs-fixer as a PHPStorm inspection tool (via Settings > Tools > PHP > Code Sniffer).Team Onboarding
CONTRIBUTING.md."Run
composer require chameleon-system/code-style-configto sync code style rules."
Rule Conflicts
no_unused_imports). Test locally before CI runs.Missing Documentation
Static Analysis Gaps
phpstan.neon is missing, rely on PHP-CS-Fixer for basic style checks.phpstan/extension-installer to add missing presets.--verbose to debug rule application:
vendor/bin/php-cs-fixer fix --verbose --rules-set=chameleon
vendor/bin/php-cs-fixer fix path/to/File.php
Custom Rulesets Merge with existing rules:
$rules = array_merge(
include 'vendor/chameleon-system/code-style-config/php-cs-fixer/rules.php',
['bracket_line_break' => true]
);
Dynamic Rule Loading
Load rules from a config file (e.g., .php-cs-fixer-chameleon.php) for flexibility.
PHPStan Integration
If phpstan.neon is provided, extend it:
includes:
- vendor/chameleon-system/code-style-config/phpstan/level-5.neon
How can I help you explore Laravel packages today?