composer require croct/coding-standard with zero manual configuration for basic usage.phpcs is installed. No Laravel-specific dependencies.phpcs.xml configuration.phpcs on large codebases (e.g., monorepos) may slow CI pipelines if not cached (e.g., via phpcs --report=emacs or parallel execution).snake_case for method names (vs. Laravel’s camelCase)?phpcs on the Laravel codebase?phpcs command.| Tool | Purpose | Croct’s Advantage |
|---|---|---|
phpcs (PSR-12) |
Basic PHP standards | Croct’s custom rules (e.g., Croct-specific patterns) |
| PHPStan | Static analysis (type safety) | Croct focuses on style/consistency, not logic |
| Larastan | Laravel-specific Stan rules | Croct is language-agnostic (but Laravel-compatible) |
./vendor/bin/phpcs and document all failures..phpcs.xml:
<config name="standard" value="Croct"/>
<arg name="report" value="full" />
<arg name="errorSeverity" value="3" /> <!-- Treat warnings as errors -->
<file>./vendor</file>
<exclude-pattern>*/tests/*</exclude-pattern>
.github/workflows/phpcs.yml:
- name: Run PHP_CodeSniffer
run: ./vendor/bin/phpcs --standard=Croct --report=checkstyle | tee results.xml
Route:: usage). Validate against the targeted Laravel version.phpcs and squizlabs/php_codesniffer.snake_case vs. camelCase).phpcs runtime on the full codebase.dev), then move to main.phpcbf) for low-effort violations.^1.0) or fork the package..phpcs.xml files may diverge across teams. Enforce a standard template.PHP_CodeSniffer may evolve. Test for backward compatibility.// over /* */?").old-system/ is exempt").phpcs failures may require deep rule knowledge. Consider a dedicated "linting lead" for complex cases.phpcs can be slow. Mitigate with:
--parallel=8 (if supported).phpcs --cache-file=.phpcs.cache).--diff).| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
CI pipeline fails on phpcs |
Blocks deployments | Start with warnings-only, then escalate. |
| Rule conflicts with PSR-12 | Developer frustration | Override conflicting rules in .phpcs.xml. |
| False positives in tests | Wasted dev time | Exclude test directories. |
| Croct updates rules |
How can I help you explore Laravel packages today?