- How do I install this coding standard for my Laravel project?
- Run `composer require --dev sylius-labs/coding-standard` and import the config in your `ecs.php` using `$ecsConfig->import(__DIR__ . '/vendor/sylius-labs/coding-standard/ecs.php');`. Ensure you also have `symplify/easy-coding-standard` installed as a dev dependency.
- Will this work with Laravel 10+ and PHP 8.2?
- Yes, this package enforces PSR-12 and Sylius conventions compatible with Laravel 10+ and PHP 8.2. However, test thoroughly in your CI pipeline, as some Sylius-specific rules may conflict with Laravel’s naming conventions (e.g., Facades or Service Providers).
- What’s the ECS v13.1.3+ conflict mentioned in the TPM assessment, and how do I fix it?
- ECS v13.1.3+ introduces a rule conflict with this package. To resolve it, either pin ECS to `<13.1.3` in `composer.json` or override the conflicting rule in your `ecs.php` by calling `$ecsConfig->skip([ConflictRuleClass])` (check PR #64 for the exact class name).
- Can I use this alongside my existing ECS config without duplication?
- Yes, simply import the Sylius config into your existing `ecs.php` using `$ecsConfig->import()`. However, if you’re using ECS v13.1.3+, you’ll need to handle the conflict explicitly to avoid rule duplication or failures.
- Does this package enforce Laravel-specific rules, or is it purely Sylius-focused?
- It primarily enforces Sylius conventions (e.g., naming, interfaces) while aligning with PSR-12. Laravel-specific patterns like Facades or Service Providers may require exceptions. Review the rules and adjust your `ecs.php` to accommodate Laravel’s conventions.
- How do I migrate from a YAML ECS config to PHP with this package?
- Use the `symplify/config-transformer` package to migrate your YAML config to PHP. After migration, import the Sylius config as usual in your `ecs.php`. The transformer handles the conversion while preserving your existing rules.
- Will this slow down my CI/CD pipeline significantly?
- No, the performance impact is minimal. However, if you encounter conflicts with ECS v13.1.3+, resolving them (via pinning or rule overrides) may require additional CI steps. Test in a staging environment to validate performance.
- Are there alternatives to this package for Laravel projects?
- Yes, alternatives include Laravel’s built-in `php-cs-fixer` config or packages like `nunomaduro/collision` for Laravel-specific rules. However, this package offers Sylius-proven conventions, which may be ideal for projects requiring consistency with Sylius ecosystems.
- How often is this package updated, and who maintains it?
- This package is maintained by SyliusLabs and updated alongside Sylius core and ECS changes. Monitor the [GitHub repo](https://github.com/SyliusLabs/CodingStandard) for updates, especially if you rely on Sylius-specific rules. Consider subscribing to release notifications.
- Can I customize or override specific rules from this package?
- Yes, you can override or skip rules in your `ecs.php` by chaining methods like `$ecsConfig->skip()` or `$ecsConfig->rules()`. For example, to disable a Sylius-specific rule, use `$ecsConfig->skip([SyliusRuleClass::class])`. Document overrides for future maintainers.