Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Bladestan Laravel Package

tomasvotruba/bladestan

Bladestan brings PHPStan-powered static analysis to Laravel Blade templates. It catches template-related issues during analysis and offers a Blade error formatter with clickable template paths and “rendered in” context for faster debugging.

View on GitHub
Deep Wiki
Context7

Bladestan brings static analysis to Laravel Blade templates by integrating with PHPStan, helping you catch template-related issues early and with clearer context. Install it as a dev dependency and, if you don’t use PHPStan’s extension installer, include its extension config in phpstan.neon—then analyze as usual.

Key features:

  • Detects issues originating from Blade rendering during PHPStan runs
  • Custom error formatter (--error-format=blade) for template-friendly output
  • Shows clickable template paths and the rendered-in Blade location/line
  • Works smoothly with modern Laravel (maintained for Laravel 10+)
Frequently asked questions about Bladestan
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.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport