- How does Janus PHP differ from php-cs-fixer or Pint for Laravel projects?
- Janus PHP focuses on static analysis and Laravel-specific conventions (e.g., Blade syntax, Eloquent naming) rather than just formatting. It includes pre-configured PHPStan rules for Symfony 8+, Doctrine, and Laravel patterns, while tools like Pint or php-cs-fixer are more generic. Janus integrates with CI/CD pipelines to automate checks like DQL validation and Task class naming, which aren’t covered by standard formatters.
- Can I use Janus PHP with Laravel 9 or older versions? What’s the Symfony 8+ requirement?
- Janus PHP is optimized for Symfony 8+ and Laravel projects using modern Symfony components (e.g., Doctrine 3.x). If your project uses Symfony 6 or older, you may need to fork the package or pin dependencies to avoid compatibility issues. The package explicitly targets Symfony 8+ for features like fixed import directories and PHPStan Symfony 8 support, so older versions won’t benefit from all rules.
- How do I install Janus PHP in a Laravel project?
- Add Janus to your project via Composer: `composer require 21torr/janus`. The package includes a Composer plugin for auto-execution, so no additional setup is required for basic linting. For PHPStan or Doctrine checks, ensure your `composer.json` includes the required dev dependencies (e.g., `phpstan/phpstan`, `doctrine/dbal`). The package’s docs provide presets for GitHub Actions and other CI tools.
- What Laravel-specific rules does Janus PHP enforce, and can I customize them?
- Janus enforces rules like Blade template validation, Eloquent model naming conventions, and Task class requirements (e.g., `Task` suffix). It also includes PHPStan extensions for Laravel’s PHPUnit integration and ignores PHPStorm-specific attributes. You can customize rules by overriding the package’s configuration or forking the repo to modify the presets. The MIT license allows full flexibility.
- Will Janus PHP slow down my CI/CD pipeline? How can I optimize performance?
- Janus PHP adds overhead primarily from PHPStan and Doctrine validation, which can increase build times. To optimize, run checks in parallel (e.g., using GitHub Actions’ `phpstan` and `php-cs-fixer` jobs concurrently) or configure PHPStan to fail only on critical errors. Profile your pipeline to identify bottlenecks—Janus is designed to be lightweight but may require adjustments for large codebases.
- Does Janus PHP support custom PHPStan extensions or third-party rules?
- Janus PHP provides a solid foundation for Laravel-specific rules but isn’t designed to replace custom PHPStan extensions. If you rely on third-party rules (e.g., `phpstan-extension-installer`), you’ll need to merge them manually with Janus’ configuration. The package’s docs outline how to extend or override rules, but complex setups may require forking the repo.
- How do I integrate Janus PHP with GitHub Actions or other CI tools?
- Janus PHP includes pre-configured workflows for GitHub Actions in its documentation. Add the provided YAML snippet to your `.github/workflows` directory to run PHPStan, PHP-CS-Fixer, and Doctrine checks automatically. The package’s Composer plugin ensures checks run on every commit or PR, reducing manual setup. For other CI tools, adapt the workflow to use Janus’ presets for PHPStan and PHP-CS-Fixer.
- Are there any known conflicts between Janus PHP and existing tools like Pest or Laravel Pint?
- Janus PHP is designed to complement tools like Pest and Pint rather than conflict with them. It focuses on static analysis (PHPStan) and Laravel conventions, while Pint handles formatting. However, if you’ve customized PHPStan or PHP-CS-Fixer rules in your project, audit your `phpstan.neon` or `.php-cs-fixer.php` for overlaps. Janus can be configured to skip specific checks if needed.
- What’s the maintenance status of Janus PHP? Is it actively updated?
- Janus PHP is currently maintained by 21TORR but has low external adoption (0 stars/dependents). The package targets Symfony 8+ and PHPStan’s evolving ecosystem, so updates may align with those dependencies. For long-term reliability, consider forking the repo to maintain custom rules or monitoring its GitHub for updates. Treat it as a temporary or internal tool until Laravel adopts a native solution.
- Can I use Janus PHP in production? What are the risks?
- Janus PHP is intended for development and CI/CD pipelines, not production. The risks include breaking changes if upstream dependencies (e.g., PHPStan, Symfony) evolve rapidly. Mitigate this by pinning versions in `composer.json` and testing Janus in a staging environment. The package’s opinionated rules may also require adjustments if your team has custom conventions, so validate its output before enforcing it strictly.