- How can I integrate **covex-nn/phpcb** into a Laravel project for automated code quality checks?
- Use Laravel’s Artisan system to create a custom command (e.g., `phpcb:generate`) that triggers PHP_CodeSniffer/PHPMD via the package. Register the command in `AppServiceProvider` and schedule it in Laravel’s scheduler for nightly runs or tie it to Git hooks for pre-commit validation.
- Does **covex-nn/phpcb** support modern PHP tools like Psalm or Pest instead of PHP_CodeSniffer?
- The package primarily wraps PHP_CodeSniffer/PHPMD, but you can extend it with custom adapters for Psalm or Pest by overriding the core analysis methods. Check the `CodeBrowser` class for hooks to inject alternative tooling while maintaining compatibility with existing visualizations.
- What Laravel versions does **covex-nn/phpcb** officially support?
- The package is framework-agnostic but designed for Laravel 8+ due to its reliance on Artisan commands and service container integration. Test thoroughly in your target Laravel version, as some features (e.g., event listeners) may require minor adjustments for older versions.
- Can I use **covex-nn/phpcb** in CI/CD pipelines without bloating build times?
- Yes. Optimize performance by running incremental analysis (e.g., via `git diff --name-only`) or leveraging Laravel’s queue system to process reports asynchronously. Store reports in `storage/app/` and upload only artifacts to CI, reducing pipeline overhead.
- How do I configure custom PHP_CodeSniffer rulesets for Laravel-specific conventions (e.g., Facades, PSR-12)?
- Define a `.phpcs.xml` or `.phpmd.xml` file in your Laravel `config/` directory and reference it in the package’s configuration. Override default rulesets to exclude Laravel-specific patterns (e.g., Facade usage) or extend them with custom sniffs for project standards.
- Will **covex-nn/phpcb** work in a Laravel monorepo or microservices architecture?
- The package supports multi-repository setups by allowing custom paths and report aggregation. For microservices, containerize the analysis (e.g., Docker) to ensure consistent environments across services, or use Laravel’s service container to inject per-service configurations dynamically.
- How do I embed the generated HTML/JS reports into a Laravel admin panel or Nova dashboard?
- Serve static reports via a Laravel route (e.g., `route('phpcb')`) with auth middleware. For Nova, use Laravel Mix to bundle the visualization assets and embed them in a custom card or resource. Alternatively, store reports in `storage/` and link to them directly.
- Are there alternatives to **covex-nn/phpcb** for Laravel that offer similar codebase utilities?
- For static analysis, consider `dealerdirect/phpcodesniffer-composer-installer` (for PHP_CodeSniffer) or `phpstan/phpstan` (for PHPStan). For visualization, tools like `roave/security-advisories` or custom Laravel packages like `spatie/laravel-analytics` (for broader metrics) may fit niche needs.
- How can I test custom rule sets or visualizations in CI before merging?
- Use PHPUnit assertions to validate sniffer/PMD output against expected XML/HTML reports. Store test snapshots in version control and compare them in CI using tools like `phpunit/phpunit` with custom assertions. For visualizations, automate screenshot comparisons with tools like `sitepoint/php-comparison`.
- What should I do if the underlying **PHP_CodeSniffer/PHPMD** dependencies become outdated or unsupported?
- Fork the package and replace the dependencies with modern alternatives (e.g., Psalm or Pest) by extending the `CodeBrowser` class. Document the changes in your project’s `README` and consider contributing back to the original repo or maintaining a community fork for shared maintenance.