- 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, add `includes: [./vendor/tomasvotruba/bladestan/config/extension.neon]` to your `phpstan.neon` file.
- Does Bladestan support Laravel 12 and Livewire 4?
- Yes, Bladestan is actively maintained for Laravel 10–12 and Livewire 3.3–4.0. It parses dynamic components, props, and custom directives out of the box. Tested with PHP 8.1+ and Livewire’s latest features.
- Can Bladestan detect issues in Mail templates or non-HTML Blade views?
- Absolutely. Bladestan analyzes all Blade templates, including Mail views (e.g., `resources/views/emails/*.blade.php`). It flags undefined methods, missing variables, and syntax errors with the same precision as regular Blade files.
- How does the `--error-format=blade` flag improve debugging?
- This flag renders errors with clickable template paths and context like `rendered in: file.blade.php:15`. Errors show the *original* Blade line causing the issue, not just the PHP file, reducing debugging time by 30–50%. Works with IDEs like PHPStorm for direct navigation.
- Will Bladestan slow down my CI/CD pipeline?
- No—it’s optimized for speed. Run `phpstan analyze --memory-limit=1G` to profile; most projects complete in under 5 minutes. Disable it in production (dev-only tool) and cache invalidation (fixed in v0.11.5) ensures no performance regression.
- How do I ignore false positives in Blade templates?
- Use PHPStan’s native rule filtering in `phpstan.neon` (e.g., `parameters.ignoreErrors: true`) or leverage Bladestan’s identifier-based ignores (since v0.11.3). For example, ignore a dynamic `@component` by adding `ignoreErrors: ['App\Components\DynamicComponent']`.
- Does Bladestan work with custom Blade directives or dynamic components?
- It supports standard Blade directives (`@include`, `@each`, `@once`) and dynamic components (`@component`). For custom directives, extend Bladestan via PHPStan rules or submit a PR—its MIT license encourages community contributions.
- What Laravel versions and PHPStan versions are supported?
- Bladestan supports Laravel 8–12 and PHP 8.1+. For PHPStan, pin to `^2.0` in `composer.json` to avoid compatibility issues. The package migrated to PHPStan 2.0 in v0.7.0 and is regularly updated for new Laravel releases.
- Can I use Bladestan alongside Psalm or Pest for static analysis?
- Yes, Bladestan integrates with existing PHPStan pipelines. It doesn’t conflict with Psalm or Pest—just add it to your `phpstan.neon` and run analyses separately. Teams often use it pre-commit to catch Blade issues early.
- What’s the best way to integrate Bladestan into GitHub Actions?
- Add a step to your workflow like `vendor/bin/phpstan analyze --error-format=blade`. Use `fail-fast: true` to block merges on critical errors. Example: `if: github.event_name == 'pull_request' && github.actor != 'dependabot'`. Pair with `--memory-limit=1G` for large projects.