Weave 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 adds static analysis for Laravel Blade templates to PHPStan, catching errors like undefined methods in your views. Includes a custom error formatter with clickable links to the exact template line.

View on GitHub
Deep Wiki
Context7

Bladestan brings static analysis to Blade templates in Laravel projects. Built as a PHPStan extension, it detects errors inside your views—such as calls to undefined methods or missing variables—and reports them against the PHP code that renders the template, catching bugs before runtime.

  • PHPStan integration via the extension installer or a single includes entry
  • Template-aware errors that trace back to the rendering controller or class
  • Custom blade error formatter with clickable links to the exact line in the template
  • Active maintenance with support for Laravel 10 and modern PHP
composer require tomasvotruba/bladestan --dev
vendor/bin/phpstan analyze --error-format=blade
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, Bladestan auto-configures. Otherwise, include `./vendor/tomasvotruba/bladestan/config/extension.neon` in your `phpstan.neon` file.
Does Bladestan work with Laravel 12 and Livewire 4?
Yes, Bladestan supports Laravel 10–12 and Livewire 3.3–4.0. It also handles dynamic components, Livewire attributes, and non-HTML mail templates. Check the [GitHub](https://github.com/bladestan/bladestan) for version-specific updates.
What types of Blade errors does Bladestan detect?
Bladestan catches undefined methods, missing variables, syntax issues, and template rendering errors. It also flags potential runtime exceptions like undefined directives or invalid component usage. The custom error formatter pinpoints exact template lines and rendered paths.
Can I customize Bladestan’s rules for my project?
Yes, Bladestan extends PHPStan’s rule engine, so you can override or extend its rules via `phpstan.neon`. Start with conservative settings to avoid false positives, then tighten rules incrementally. Use `ignoreErrors` for known edge cases.
How do I integrate Bladestan into CI/CD pipelines?
Run `vendor/bin/phpstan analyze --error-format=blade` in your CI. Decide whether to fail builds on critical errors or treat them as warnings. Cache PHPStan results to speed up CI runs. Example: `phpstan analyze --level=5 --error-format=blade` for strict checks.
Will Bladestan slow down my Laravel application in production?
No, Bladestan is a static analysis tool with no runtime overhead. It runs during development or CI, not in production. Use PHPStan’s result caching to minimize analysis time in pipelines.
How do I exclude certain Blade templates from analysis?
Add `excludeFiles` or `excludePaths` to your `phpstan.neon` to skip non-critical templates. For example: `excludePaths: ['resources/views/legacy/*']`. Focus on high-impact templates like forms, emails, or critical views first.
What if Bladestan produces false positives for dynamic Blade logic?
False positives often occur with dynamic method calls or complex logic. Start with a permissive rule set, then enable stricter checks gradually. Use `ignoreErrors` in `phpstan.neon` to suppress known false positives, like `ignoreErrors: ['#Call to undefined method.*#']`.
Does Bladestan support Symfony components or non-HTML templates?
Yes, Bladestan analyzes non-HTML templates (e.g., mail views) and supports Symfony components when used in Blade. For Livewire or Symfony integrations, test with representative templates early and monitor updates for compatibility with newer versions.
What are the alternatives to Bladestan for Blade static analysis?
Alternatives include custom PHPStan rules or tools like `laravel-blade-analyzer` (older, less maintained). Bladestan stands out for its Laravel-specific focus, Livewire support, and integration with PHPStan’s ecosystem. If your team doesn’t use PHPStan, consider starting with it for broader static analysis benefits.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console