m6web/coke
Coke is a CLI wrapper around PHP_CodeSniffer that lets you manage per-project rules via a .coke file. Run phpcs with easy include/exclude lists, optional “only git changed” mode, verbose output, and pass through any phpcs arguments.
m6web/coke) is a deprecated PHP Code Sniffer configurator (last updated in 2017), designed for legacy PHP projects. It does not align with modern Laravel (v10+) or contemporary PHP (8.1+) architectures, which rely on:
include_path configurations.php-cs-fixer, Laravel’s phpunit.xml presets) for static analysis.php-cs-fixer (active maintenance) and PHPStan.php-cs-fixer + custom rules (via config/cs.php).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Dependency Conflicts | Critical | Use composer require --ignore-platform-reqs or vendor patching. |
| Security Vulnerabilities | High | Package has no updates since 2017; audit for CVEs in transitive deps (e.g., old PHPUnit). |
| Maintenance Overhead | High | Requires manual patching or fork maintenance. |
| False Positives/Negatives | Medium | Rules may conflict with modern Laravel conventions (e.g., type hints, named arguments). |
| CI/CD Breakage | High | Likely to fail in modern PHP environments. |
Why Deprecated?
php-cs-fixer?Alternatives Evaluated
php-cs-fixer + php-cs-fixer-config been tested as a drop-in replacement?laravel-pint, pestphp/pest) that could replace this?Migration Path
php-cs-fixer?Team Skills
composer.json structures (no autoload-dev for tools).legacy-branch is targeted").Assessment Phase:
composer why m6web/coke to identify direct/indirect dependencies.Coke/Config.php and port to php-cs-fixer (e.g., via --rules config).Phased Replacement:
php artisan coke:check).php-cs-fixer + custom rules (example config below).
# php-cs-fixer.config.php
return PhpCsFixer\Config::create()
->setRules([
'@PSR12' => true,
'concat_space' => ['spacing' => 'one'], // Example: Mimic Coke's rules
]);
LEGACY_RULES.md file.Fallback Strategy:
Dockerfile:
FROM composer:7.1
RUN composer require m6web/coke:dev-master
COPY . /app
WORKDIR /app
CMD ["vendor/bin/phpcs", "--standard=Coke/Config", "--report=full"]
| Component | Compatibility Risk | Workaround |
|---|---|---|
| Laravel Framework | ❌ High | Isolate in a separate process/container. |
| PHP 8.1+ | ❌ Critical | Use Docker/PHP 7.1 container. |
| Composer 2.x | ⚠️ Medium | May fail on composer.lock parsing. |
| Modern PSR-4 | ❌ High | Rules may misinterpret autoloaded classes. |
| GitHub Actions | ⚠️ Medium | Requires custom PHP setup. |
m6web/coke.php-cs-fixer incrementally (e.g., one rule per sprint).php-cs-fixer format.php-cs-fixer.php-cs-fixer.| Failure Scenario | Impact | Detection Method |
|---|---|---|
| PHP Version Incompatibility | CI/CD Blockage | composer validate fails. |
| Rule Conflicts | False Positives | Manual review of failing tests. |
| Dependency Vulnerabilities | Security Risk | composer audit flags CVEs. |
| Toolchain Breakage | Developer Blockers | php artisan coke:check fails. |
How can I help you explore Laravel packages today?