- Can Peck be used in Laravel projects to enforce consistent naming conventions?
- Yes, Peck is ideal for Laravel projects. It checks filenames, class/method names, and docblocks—critical areas where typos or inconsistencies can harm readability. Use the built-in `laravel` preset to ignore framework-specific terms like `Illuminate` or `Eloquent` while catching developer-specific errors.
- How do I install Peck in a Laravel project?
- Run `composer require peckphp/peck --dev` to install Peck as a dev dependency. Then initialize it with `./vendor/bin/peck --init`. Ensure GNU Aspell is installed system-wide (e.g., `sudo apt-get install aspell aspell-en` on Ubuntu or `brew install aspell` on macOS).
- Will Peck slow down my Laravel application in production?
- No, Peck is a CLI tool and has zero runtime impact on your Laravel app. It’s designed for development and CI workflows, not production. Install it as a dev dependency to avoid bloating your production environment.
- Does Peck support custom dictionaries for domain-specific terms?
- Yes, Peck allows custom dictionaries via `peck.json` configuration. Add domain-specific terms (e.g., `UserModel` instead of `user_model`) to avoid false positives. The `laravel` preset already handles framework terms, but you can extend it further for your project’s needs.
- How can I integrate Peck into GitHub Actions for Laravel?
- Add a step to your CI workflow to install Aspell (e.g., `sudo apt-get install aspell aspell-en`) followed by `composer test:typos` or `./vendor/bin/peck run`. Fail the build if Peck finds issues, ensuring spelling consistency before merging. Example: Use a custom script to run Peck after tests.
- What Laravel versions does Peck support?
- Peck is a standalone tool and doesn’t depend on Laravel versions. It works with any Laravel project (5.8+) as long as PHP 8.2+ is installed. Test it locally before enforcing it in CI, as it’s still under active development.
- How do I ignore false positives like `Illuminate` or `eloquent` in Peck?
- Use the `laravel` preset (`peck --preset laravel`) to ignore framework terms. For additional terms, edit `peck.json` and add them to the `ignore` array. Start with the preset, then refine the config based on your team’s feedback to minimize manual overrides.
- Can Peck replace PHPStan or Pest for code quality?
- No, Peck focuses on spelling/grammar (e.g., typos in `UserController` vs. `UserContoller`), while PHPStan and Pest handle static analysis and unit tests. Use Peck as a complementary tool—run it alongside PHPStan in CI for a full developer experience (DX) check.
- What are the alternatives to Peck for Laravel spell-checking?
- Alternatives include `php-cs-fixer` (for coding standards) or `roave/security-advisories` (for security), but neither handles spelling. For pure spell-checking, consider `cspell` (JavaScript/TypeScript) or `aspell` directly, though Peck is the most Laravel-integrated option with presets and CLI ease.
- How do I handle Windows compatibility for Peck in CI?
- Peck requires GNU Aspell, which isn’t natively available on Windows. Use WSL (Windows Subsystem for Linux) or install Aspell via Scoop (`scoop install main/aspell`). For CI, document the setup in your workflow or use Docker images with Aspell pre-installed to avoid flaky builds.