- How do I install Codestyler for a Laravel project?
- Run `composer require dragon-code/codestyler --dev` to install. Then add `post-update-cmd` scripts to your `composer.json` to auto-publish `pint.json`, `.editorconfig`, and configure Biome via `vendor/bin/codestyle`. Start with `codestyle pint 8.5` (replace 8.5 with your PHP version).
- Which Laravel versions does Codestyler support?
- Codestyler works with Laravel 8.2+ projects. It includes Pint presets for Laravel 8.2–8.5 and Rector rules tailored for Laravel-specific patterns. For older Laravel versions, you may need to manually adjust presets or exclude risky Rector rules.
- Can Codestyler handle JavaScript/TypeScript formatting?
- Yes, Codestyler integrates Biome for JS/TS linting and formatting. It publishes a `biome.json` file during setup, but you’ll need Node.js installed. Biome excludes `analytics.*` and `metrics.*` files by default, which may need customization for your project.
- Will Codestyler break legacy PHP code (e.g., pre-PHP 8.2)?
- Codestyler’s Rector rules include 'risky' transformations (e.g., `modernize_strpos`) that may break legacy code. Test in a staging environment first, and use `.codestylerignore` to exclude problematic files. For PHP <8.2, avoid the 8.5 preset and stick to 8.2 or manual rule adjustments.
- How does Codestyler integrate with GitHub Actions?
- Codestyler provides pre-configured workflows for GitHub Actions. Add a step like `vendor/bin/codestyle lint` to your CI pipeline to enforce formatting. It works alongside Laravel’s native Pint and Rector, reducing setup time for style checks in PRs.
- Can I customize Codestyler’s Pint or Rector rules?
- Codestyler uses opinionated presets (e.g., Laravel Pint 8.5), but you can override them by editing `pint.json` or `.rector.php`. For deep customization, manually adjust the published files or exclude specific rules. Biome’s `biome.json` is also editable post-installation.
- Does Codestyler slow down `composer update` in development?
- Codestyler’s `post-update-cmd` scripts run after updates, which may add a few seconds. To mitigate this, use `--parallel` with Pint and exclude large directories (e.g., `node_modules`). For faster dev workflows, consider running Codestyler only in CI or via a separate script.
- What if my team uses alternative tools like ESLint or PHP-CS-Fixer?
- Codestyler is designed for teams prioritizing consistency over customization. If you rely on ESLint or PHP-CS-Fixer, avoid installing Codestyler to prevent conflicts. For hybrid setups, manually merge configs or exclude files using `.codestylerignore`.
- How do I handle conflicts with existing CI/CD pipelines?
- Codestyler overrides `post-update-cmd` and adds style scripts. Audit your existing CI for conflicts (e.g., duplicate linting steps). Test with `composer style` locally before merging. For GitLab CI or other platforms, adapt the workflows to call `vendor/bin/codestyle lint` explicitly.
- Is Codestyler actively maintained, and how do I update presets?
- Codestyler is maintained by The Dragon Code, with updates for Pint, Rector, and Biome presets. To update, run `composer update dragon-code/codestyler` and review changes in `pint.json` or `.editorconfig`. For major version bumps (e.g., Pint 8.5 → 8.6), test in a staging branch first.