symplify/easy-coding-standard
Easy Coding Standard runs PHP_CodeSniffer and PHP-CS-Fixer rules together through one simple PHP config file. Install on any PHP 7.2–8.5 project, get parallel speed out of the box, use prepared sets, and fix code with a single command.
PsrAutoloadingFixer (ported in 13.3.7) helps enforce class-name-to-file-path consistency, which is critical for Laravel’s PSR-4 autoloading. The symplify/coding-standard dependency suggests compatibility with Laravel’s ecosystem.composer require symplify/easy-coding-standard --dev. Minimal setup (e.g., ecs.php config) leverages Laravel’s existing Composer workflow.PSR_12 and layer Laravel-specific rules (e.g., Symplify\EasyCodingStandard\RuleSet\LaravelRuleSet) as needed. Config validation and IDE autocompletion (via ECSConfig) reduce errors. Release 13.3.7 models five more fixer configurations (e.g., ModifierKeywordsFixer, SingleImportPerStatementFixer), ensuring custom settings are respected instead of ignored.php-cs-fixer/phpcs commands with vendor/bin/ecs check in pipelines. Output formats (e.g., GitLab/Checkstyle) integrate with Laravel’s CI tools (GitHub Actions, GitLab CI). The new --fix mode now prints per-file diffs and applied checkers (gated on --no-diffs), improving reviewability before commits.symfony/console version mismatches). ECS’s use of squizlabs/php_codesniffer:^4.0 may conflict with Laravel’s bundled php-codesniffer (if used).config/array.php). Requires rule whitelisting/blacklisting. The new --fix diff output helps catch unintended changes. Additionally, 13.3.7 fixes corruption in RemoveSuperfluousReturnNameFixer (conditional return types) and import-group blank-line handling, reducing false positives.FnMatchPathNormalizer) could impact low-memory environments.app/Providers/, Blade syntax, Eloquent naming)?symfony/* dependencies?use statements in Blade files") beyond PSR-12?check mode provides dry-run previews. The new --fix mode now shows diffs of changed files, but is there a dedicated flag to review all proposed changes before applying (beyond --no-diffs)?.blade.php, Artisan commands) without false positives/negatives?gitlab, checkstyle).ecs.php autocompletion.php-cs-fixer (if used) with a faster, unified tool.app/ structure via path configuration (e.g., paths([__DIR__.'/app'])).PsrAutoloadingFixer further aligns with Laravel’s PSR-4 autoloading.php_cs.dist/.php_cs and PHP-CS-Fixer configs for Laravel-specific rules.composer require symplify/easy-coding-standard --dev
vendor/bin/ecs init # Generates ecs.php with PSR-12 defaults
ecs.php:use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([
__DIR__.'/app',
__DIR__.'/config',
__DIR__.'/routes',
]);
$ecsConfig->sets([
SetList::PSR_12,
// Laravel-specific (if available)
// SetList::LARAVEL,
]);
// Whitelist/blacklist rules as needed
$ecsConfig->ruleWithConfiguration(
\Symplify\EasyCodingStandard\Rule\Commenting\InlineTodoRule::class,
['skip' => ['**/Tests/*']]
);
};
--fix to resolve issues:
vendor/bin/ecs check --fix --parallel --no-interaction
--fix mode before committing.Symplify\EasyCodingStandard\Rule\Naming\ExplicitStringClassRule)..github/workflows/ or gitlab-ci.yml:
- name: Run ECS
run: vendor/bin/ecs check --no-diffs --format=gitlab
vendor/bin/ecs check app/Http).@foreach loops).symfony/console). Use composer why symfony/console to resolve conflicts.php artisan ecs) for local runs.Settings > Languages & Frameworks > PHP > Code Sniffer).php-cs-fixer/php-codesniffer requires periodic updates (e.g., v13.x’s squizlabs/php_codesniffer:^4.0). Use composer update symplify/easy-coding-standard cautiously.ecs.php or rule set for Laravel-specific conventions (e.g., app/Providers/ naming).ContainerConfigurator deprecation in favor of ECSConfig).skip or custom rules. Release 13.3.7 reduces false positives in import groups and conditional return types.--fix with diff review) to limit blast radius.How can I help you explore Laravel packages today?