dbrekelmans/coding-standard
PHP coding standard package based heavily on the Doctrine coding standard. Provides shared rules and configuration to enforce consistent formatting and style across projects, helping teams catch issues early and keep codebases clean.
doctrine/coding-standard:^8.1 introduces new rules (e.g., stricter DQL formatting, updated annotation syntax).@ORM\ vs. #[Attribute]).php-cs-fixer (via laravel/framework) still covers PSR-12, but this package now explicitly extends Doctrine’s latest standards.squizlabs/php_codesniffer) and Doctrine Coding Standard v8.1.composer require --dev dbrekelmans/coding-standard doctrine/coding-standard:^8.1
.phpcs.xml:
<rule ref="Dbrekelmans/CodingStandard">
<exclude name="Doctrine.Annotations.DeprecatedAnnotations"/> <!-- Example: Exclude deprecated rules -->
</rule>
WHERE clause alignment).@ORM\Column vs. @Column).--warning-severity=0 to gradually enforce new rules.@ORM\ annotations vs. PHP 8 attributes).@ORM\Table) may trigger false positives.doctrine/coding-standard:^8.1, which is actively maintained (unlike the original package).#[UniqueEntity] vs. @UniqueEntity)..phpcs.xml (e.g., disabling @ORM\ rules for Eloquent-heavy projects).php-cs-fixer to Laravel’s built-in formatter.stof/doctrine-extensions-bundle.composer show doctrine/orm).composer --version).composer require --dev dbrekelmans/coding-standard doctrine/coding-standard:^8.1
.phpcs.xml to include new rules:
<config name="installed_paths" type="array">
<element>./vendor/dbrekelmans/coding-standard</element>
</config>
<rule ref="Dbrekelmans/CodingStandard">
<exclude name="Doctrine.Annotations.DeprecatedAnnotations"/> <!-- Example exclusion -->
</rule>
./vendor/bin/phpcs --standard=Dbrekelmans/CodingStandard --warning-severity=0 app/
php-cs-fixer (if automated fixes are needed).<exclude> for Eloquent-specific rules:
<rule ref="Dbrekelmans/CodingStandard">
<exclude name="Doctrine.Annotations.ORM"/> <!-- Disable if using Eloquent attributes -->
</rule>
JOIN clause formatting).@ORM\ vs. @Column).phpcs in warning mode to assess new rule impact.@ORM\ annotations).php-cs-fixer for automated DQL/annotation fixes.doctrine/coding-standard:^8.1, which is actively maintained.8.1.x) to avoid surprises.WHERE clauses need exact spacing).How can I help you explore Laravel packages today?