if statements). Useful for teams enforcing consistent, opinionated coding styles.squizlabs/php_codesniffer).composer require instaclick/coding-standard)..phpcs.xml or .phpcs.ruleset.xml.| Risk | Severity | Mitigation |
|---|---|---|
| Rule conflicts | Medium | Test against existing PSR-12 rules; override conflicting rules in .phpcs.xml. |
| Performance overhead | Low | CodeSniffer runs during dev/test phases, not production. |
| Maintenance burden | Low | Rules are static; updates only needed if Instaclick modifies their standard. |
| Tooling dependency | Medium | Requires PHP_CodeSniffer (already common in PHP ecosystems). |
laravel-pint, psalm)?php-cs-fixer).if) vs. optional ones.composer.json:
"require-dev": {
"instaclick/coding-standard": "^1.0"
}
.phpcs.xml:
<config name="instaclick" extension=".php">
<rule ref="Instaclick"/>
</config>
vendor/bin/phpcs --standard=Instaclick src/
.github/workflows/lint.yml:
- name: Run PHP_CodeSniffer
run: vendor/bin/phpcs --standard=Instaclick --warning-severity=0 src/
use App\Models\...) may conflict with Object Calisthenics (e.g., no long namespaces).| Phase | Tasks |
|---|---|
| 1. Evaluation | Run against codebase; document conflicts. |
| 2. Configuration | Set up .phpcs.xml; exclude test/vendor files if needed. |
| 3. CI Integration | Add to GitHub Actions/GitLab CI as a non-blocking check initially. |
| 4. Enforcement | Transition to blocking in CI; pair with PHP-CS-Fixer for fixes. |
| 5. Documentation | Update team docs with new standards; train developers. |
.phpcs.xml may need updates over time.if).if ($request->has(...))).--ignore or custom rulesets.--cache flag).| Failure Mode | Impact | Mitigation |
|---|---|---|
| Overly strict rules | Blocks PRs unnecessarily. | Start with warnings; allow exceptions via comments (// phpcs:ignore). |
| Tooling conflicts | PHP-CS-Fixer/CodeSniffer overlap. | Define a single source of truth (e.g., prioritize CodeSniffer). |
| Rule drift | Instaclick updates break existing code. | Pin to a specific version or fork critical rules. |
| Low adoption | Developers disable linters. | Enforce in CI; pair with code reviews highlighting violations. |
How can I help you explore Laravel packages today?