Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Peck Laravel Package

peckphp/peck

Peck is a fast CLI spell-checker for your codebase—filenames, class/method/property names, docs, and more. Powered by GNU Aspell, it helps catch wording and spelling mistakes and fits neatly into workflows like Pint or Pest. Requires PHP 8.2+ and Aspell.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

Peck is a standalone CLI tool with no native Laravel integration (e.g., service providers, config files, or event hooks). It operates as a pre-commit or CI-level check, similar to PHPStan or Pest, rather than a core framework component. Its focus on spelling/grammar in code comments, strings, and documentation aligns well with Laravel’s emphasis on maintainable, user-facing code (e.g., error messages, validation rules, or API responses). However, it lacks:

  • Laravel-specific presets beyond the basic laravel preset (e.g., no built-in support for Blade templates, Eloquent model naming conventions, or Artisan command terminology).
  • IDE/editor integration (e.g., no VS Code/Laravel IDE Helper plugins), requiring manual CLI invocation.
  • Dynamic context awareness (e.g., it cannot distinguish between a typo in a string literal and a valid variable name like userId).

Integration Feasibility

  • Composer Integration: Low risk—Peck installs via Composer (peckphp/peck) and runs as a binary (./vendor/bin/peck). No Laravel-specific dependencies exist, but it requires GNU Aspell (a system-level dependency), which may complicate cross-environment consistency (e.g., CI vs. local dev).
  • Configuration Override: The peck.json file supports project-specific ignores (e.g., Laravel’s config(), route(), or DB:: terms), but requires manual setup. No Laravel config publisher or config/peck.php integration exists.
  • CI/CD Plugins: No native GitHub Actions/Laravel Forge support, but it can be added via custom workflows (as shown in the README). Risk: false positives may require manual triage in CI pipelines.

Technical Risk

  • Dependency Stability: Peck relies on GNU Aspell (a third-party system tool) and PHP 8.2+. Laravel projects on older PHP versions (e.g., 8.1) or unsupported OSes (e.g., Windows without WSL) may face compatibility issues.
  • False Positives/Negatives:
    • High risk for technical terms: Laravel-specific words (e.g., Illuminate, ServiceProvider, Route::get) may trigger false positives unless explicitly ignored.
    • No grammar context: Peck only checks spelling, not grammar/syntax (e.g., "their" vs. "there" in comments). For advanced use cases, this may require pairing with tools like LanguageTool or PHP-CS-Fixer.
  • Performance: Linear file scanning could slow down large monorepos (e.g., Laravel + Vue/React). Mitigation: Use --path to limit scope or .gitignore-style exclusions in peck.json.
  • Maturity: Marked as "not ready for production" in the README, with active development but no major version releases. Risk of breaking changes or undocumented behavior.

Key Questions for the TPM

  1. Stakeholder Alignment:
    • Does the team prioritize spelling/grammar over other quality gates (e.g., static analysis, unit tests)?
    • Are there existing tools (e.g., PHP-CS-Fixer, PSR-12) that could conflict or duplicate efforts?
  2. CI/CD Impact:
    • How will false positives be handled in CI? (e.g., manual approvals, auto-ignores via peck.json).
    • Will Peck run in pre-commit (faster feedback) or post-commit CI (broader scope)?
  3. Maintenance:
    • Who will curate the peck.json ignores? (e.g., a shared config repo or per-project files).
    • How will new Laravel-specific terms (e.g., Livewire, Jetstream) be added to the preset?
  4. Alternatives:
    • Should we evaluate LanguageTool (grammar) or Textlint (multi-language support) for broader needs?
    • Is the Laravel preset sufficient, or should we build a custom extension?

Integration Approach

Stack Fit

Peck is agnostic to Laravel’s stack but integrates via:

  • Composer: Installs as a dev dependency (--dev flag recommended).
  • CLI: Runs as a binary (./vendor/bin/peck), compatible with Laravel’s existing toolchain (e.g., Artisan, composer scripts).
  • Configuration: Uses peck.json (YAML/JSON), which can coexist with Laravel’s config/ files but requires manual sync.

Best Fit For:

  • Projects with user-facing strings (e.g., error messages, API responses, Blade templates).
  • Teams using CI/CD pipelines (GitHub Actions, GitLab CI) for pre-deployment checks.
  • Codebases with documentation-heavy files (e.g., Markdown, .php docblocks).

Misalignment:

  • Binary-heavy projects (e.g., Laravel + Vue/React with minimal PHP strings).
  • Teams relying on IDE plugins (e.g., PHPStorm’s built-in spellcheck).
  • Non-English projects without Aspell support for the target language.

Migration Path

  1. Pilot Phase:
    • Install in a non-critical branch (composer require --dev peckphp/peck).
    • Run locally with --init to generate peck.json and review false positives.
    • Test in CI with a non-blocking job (e.g., if [ "$CI" = "true" ]; then ./vendor/bin/peck --quiet; fi).
  2. Laravel-Specific Tuning:
    • Extend the laravel preset in peck.json to ignore Laravel terms:
      {
        "preset": "laravel",
        "ignore": {
          "words": ["Illuminate", "ServiceProvider", "route", "DB::", "config()"],
          "paths": ["resources/views", "tests"]
        }
      }
      
    • Add inline ignores for edge cases (e.g., // @peck-skip in Blade files).
  3. CI Integration:
    • Add to composer.json scripts:
      "scripts": {
        "lint:peck": "peck --report=checkstyle > build/peck-report.xml",
        "test": ["lint:peck", "@phpunit"]
      }
      
    • Configure GitHub Actions:
      - name: Peck Spellcheck
        run: composer lint:peck
      
  4. Gradual Enforcement:
    • Start with warnings-only mode (CI exits with 0).
    • Transition to blocking after 2–4 weeks of tuning.

Compatibility

Component Compatibility Mitigation
PHP Version Requires 8.2+ (Laravel 9+). Upgrade PHP or use a polyfill (high risk).
OS Dependencies GNU Aspell must be installed (Linux/macOS/WSL). Document setup in CONTRIBUTING.md.
Laravel Features No native support for Blade, Eloquent, or Artisan commands. Manually ignore paths (e.g., app/Console).
CI Systems Works with GitHub Actions, GitLab CI, and self-hosted runners. Add OS-specific Aspell install steps.
IDE Tools No VS Code/Laravel IDE Helper integration. Use CLI or third-party plugins.

Sequencing

  1. Phase 1 (Week 1): Local testing + preset tuning.
  2. Phase 2 (Week 2): CI integration (non-blocking).
  3. Phase 3 (Week 3): Enforce in pre-commit hooks (e.g., husky).
  4. Phase 4 (Ongoing): Review and update peck.json as new Laravel terms emerge.

Operational Impact

Maintenance

  • Configuration Drift: peck.json requires ongoing curation as the codebase evolves (e.g., new Laravel features, custom terminology). Solution: Shared config repo or team-owned ignores.
  • Dependency Updates: Peck’s MIT license and active development suggest low maintenance risk, but GNU Aspell updates may require OS-level patches.
  • Tooling Overhead: Minimal—no Laravel-specific maintenance, but requires documentation for new contributors (e.g., "How to ignore a false positive").

Support

  • Onboarding: Low—Peck’s CLI interface is intuitive, but teams must understand:
    • How to add ignores (peck.json or inline comments).
    • How to interpret false positives (e.g., userId vs. userid).
  • Troubleshooting:
    • Aspell errors: "Install GNU Aspell" is the top support request.
    • Performance issues: Limit scan paths with --path or `.git
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation
uri-template/tests