peckphp/peck
Peck is a fast PHP CLI that spell-checks your codebase—filenames, classes, methods, properties, docs, and more—using GNU Aspell. Built to fit naturally into your workflow like Pint or Pest. Requires PHP 8.2+ and Aspell.
Peck’s CLI-based, lexicon-focused design integrates seamlessly with Laravel’s developer-centric toolchain (e.g., Artisan, Composer, CI/CD pipelines). It operates at the code readability layer, addressing gaps left by static analyzers (PHPStan) or formatters (Pint) by targeting naming conventions, documentation, and textual consistency. The tool’s reliance on GNU Aspell for spell-checking is a strength, leveraging a battle-tested NLP library, but introduces a system-level dependency that may require additional infrastructure (e.g., Docker, WSL for Windows).
Key Synergies:
snake_case for migrations, PascalCase for classes) reduces configuration overhead.Potential Frictions:
peck.json.Peck’s integration hinges on three pillars:
husky/laravel-valet) or CI gates (GitHub Actions, GitLab CI). Example:
# GitHub Actions
- name: Run Peck
run: composer test:typos # Custom script to invoke ./vendor/bin/peck
peck.json preset system enables team-specific rules (e.g., ignoring laravel framework terms or project-specific acronyms).Feasibility Score:
| Criteria | Score (1-5) | Notes |
|---|---|---|
| Dev Environment | 4 | Requires Aspell install; minimal Laravel config changes. |
| CI/CD | 3 | Aspell setup adds ~5-10 mins to CI pipeline; Windows may need WSL. |
| Cross-Platform | 3 | Windows support is viable but less polished than Linux/macOS. |
| Laravel Compatibility | 5 | Laravel preset reduces setup time; no core conflicts. |
| Risk Area | Severity (1-5) | Mitigation Strategy |
|---|---|---|
| Aspell Dependency | 4 | Document Aspell installation in CONTRIBUTING.md; provide Docker/WSL fallback. |
| False Positives | 3 | Leverage peck.json to whitelist project-specific terms; start with --ignore-all. |
| Performance | 2 | Benchmark on large codebases (e.g., 100K+ LOC); cache Aspell dictionaries. |
| Breaking Changes | 4 | Monitor Peck’s GitHub for v1.0 release; pin version in composer.json. |
| IDE Integration | 1 | No risk; Peck is CLI-only (complements IDE plugins like PHPStorm’s spell-check). |
Critical Question:
Adoption Scope:
Configuration Management:
peck.json be version-controlled or environment-specific?Tooling Stack:
laravel-valet)?Long-Term Viability:
Peck’s integration targets three layers of the Laravel ecosystem:
Developer Workflow:
package.json scripts or .husky/pre-commit:
"scripts": {
"check:typos": "php vendor/bin/peck"
}
./vendor/bin/peck manually).CI/CD Pipeline:
composer install):
- name: Spell Check
run: composer check:typos
before_script to install Aspell and run Peck.Laravel-Specific Hooks:
php artisan peck) to wrap Peck’s CLI.| Phase | Action Items | Risks | Mitigation |
|---|---|---|---|
| Pilot | 1. Install Peck in a non-critical branch. | False positives. | Use --ignore-all initially. |
2. Test with peck --init and Laravel preset. |
Aspell setup issues. | Document Aspell install steps. | |
| Validation | 3. Run manually in local dev environments. | Performance lag. | Benchmark on a subset of files. |
| 4. Integrate with pre-commit hooks (optional). | Developer friction. | Make it opt-in. | |
| CI Integration | 5. Add to GitHub Actions/GitLab CI as a non-blocking step. | CI flakiness. | Isolate Aspell install in a job. |
| Enforcement | 6. Block PRs with Peck failures (optional). | Team resistance. | Start with warnings, then enforce. |
| Optimization | 7. Refine peck.json for team-specific rules. |
Maintenance overhead. | Use shared config templates. |
Rollout Timeline:
| Component | Compatibility Notes |
|---|---|
| PHP Version | Requires PHP 8.2+; no conflicts with Laravel’s supported versions (8.2+). |
| Laravel Version | Tested with Laravel 8+; preset includes Symfony 8+ compatibility. |
| Operating Systems | Linux/macOS: Native support. Windows: Requires WSL/Scoop. |
| Existing Tools | - Pint/PHP-CS-Fixer: No conflicts (Peck checks content, not formatting). |
| - PHPStan: Complementary (Peck for naming, PHPStan for logic). | |
| - Pest: No overlap (Peck doesn’t analyze test logic). | |
| Monorepos | Limited support; focus on PHP/Laravel directories only. |
composer.json (--dev)../vendor/bin/peck --init to generate peck.json."preset": "laravel").acronyms, frameworkTerms).peck.json as needed.How can I help you explore Laravel packages today?