- How do I install Bladestan for Laravel Blade static analysis?
- Run `composer require tomasvotruba/bladestan --dev` to add it as a development dependency. If using PHPStan’s extension installer, it auto-configures. Otherwise, include the provided `extension.neon` in your `phpstan.neon` file under the `includes` section.
- Does Bladestan work with Laravel 10, 11, or 12?
- Yes, Bladestan is actively maintained for Laravel 10+ and supports PHP 8.1+. It also works with Livewire 3/4. Check the GitHub repo for version-specific updates, as newer Laravel releases may require minor adjustments.
- What types of Blade issues does Bladestan detect?
- It catches undefined methods, missing variables, invalid directives (e.g., `@include` with wrong parameters), and Livewire prop mismatches. The custom `--error-format=blade` flag highlights where errors render in `.blade.php` files with clickable line numbers.
- Can I use Bladestan in CI/CD pipelines?
- Absolutely. Bladestan is designed for CI/CD—add it to your GitHub Actions, GitLab CI, or other pipelines. Run `phpstan analyze --error-format=blade` in your test stage to catch Blade issues before deployment. It’s zero-overhead in production.
- How do I handle false positives in dynamic Blade templates?
- Blade’s dynamic nature (e.g., `@php` blocks) may trigger false positives. Start by running Bladestan on high-risk templates, then tweak `phpstan.neon` to ignore known issues. The package includes a `Livewire` section for dynamic component validation.
- Does Bladestan support custom Blade paths (e.g., package views)?
- Yes, but you may need to configure Laravel’s `view.paths()` to include non-standard paths. Bladestan respects Laravel’s view resolution system. Test path coverage early by running it against your custom paths before full integration.
- What’s the difference between `--error-format=blade` and default PHPStan output?
- The `--error-format=blade` flag provides Blade-specific context, like showing *which Blade template* renders the error (e.g., `post_codex.blade.php:15`) and clickable file links. Default output lacks this template-aware detail, making debugging slower.
- Can Bladestan validate Livewire component props?
- Yes, it validates Livewire props, dynamic components, and shared data. For complex props (e.g., nested objects), you might need to adjust PHPStan’s `Livewire` rules in `extension.neon`. Test with representative components first.
- Will Bladestan slow down my Laravel app in production?
- No, Bladestan is a *static analysis* tool—it runs during development or CI, not in production. It has zero runtime overhead and integrates with PHPStan’s caching for fast repeated runs.
- Are there alternatives to Bladestan for Blade static analysis?
- Few tools specialize in Blade static analysis. Alternatives include generic PHPStan rules (less Blade-aware) or manual QA. Bladestan stands out for its Laravel-centric features (Livewire support, custom error formatting) and active maintenance.