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

Product Decisions This Supports

  • Zero-Defect Blade Templates: Integrate Bladestan into CI/CD pipelines to catch undefined methods, missing variables, and syntax errors in Blade templates, reducing runtime bugs and improving reliability. Directly supports SRE goals by shifting validation left.
  • Shift-Left Quality for Views: Enable pre-commit and CI-level validation of Blade templates, reducing runtime error handling overhead and supporting faster release cycles. Critical for teams using feature flags or canary deployments.
  • Livewire and Component Safety: Validate Livewire props, dynamic components, and shared data passed to views, reducing flakiness in interactive features. Directly supports modular UI architectures and component-driven development.
  • Unified Static Analysis: Extend existing PHPStan investments to cover Blade templates, avoiding tooling fragmentation and reducing maintenance overhead. Aligns with "one tool to rule them all" philosophy.
  • Security Hardening: Prevent template injection risks and type-related vulnerabilities, supporting compliance with security-first development policies.
  • Developer Productivity: Cut debugging time for Blade issues by 30–50% with line-accurate, clickable error reports, improving focus during feature development.
  • Tech Debt Reduction: Identify inconsistent data binding patterns and unmaintained templates, enabling targeted refactoring and supporting code health initiatives.
  • CI/CD Pipeline Optimization: Reduce flaky tests caused by template errors, improving test reliability and build stability, and enabling gated deployments for high-risk template changes.

When to Consider This Package

Adopt when:

  • Your team uses PHPStan and wants to extend static analysis to Blade templates to catch undefined methods, missing variables, or invalid directives before runtime.
  • You experience recurring Blade bugs in production (e.g., {{ $user->address }} failing due to undefined properties), costing support time or revenue.
  • Your project uses Laravel 8+, Livewire 3/4, or dynamic Blade features (e.g., @component, @include, @once) where static validation is critical.
  • You need actionable error reports with clickable file/line links for CI/CD, developer onboarding, or pair programming.
  • Your codebase relies on shared data, components, or mail templates where runtime failures are costly.
  • You’re investing in PHPStan or static analysis and want to future-proof Laravel projects with end-to-end validation.
  • Your team adopts modular Blade components or Livewire and needs to ensure type safety and consistency across templates.
  • You’re migrating from legacy Blade patterns to structured data binding and need validation to enforce best practices.

Look elsewhere when:

  • Your project has minimal Blade usage or uses non-Laravel templates (Twig, Vue, React).
  • You don’t use PHPStan—this package is a PHPStan extension and adds no standalone value.
  • Your templates rely on highly dynamic Blade logic that can’t be statically resolved without manual configuration.
  • You need runtime validation or interactive debugging (use Laravel Telescope or debugbar instead).
  • Your team lacks PHPStan familiarity, as setup requires basic knowledge of phpstan.neon.
  • You’re using Laravel < 8 or custom Blade directives not supported by the package.
  • Your legacy templates use global variables or undefined logic that can’t be statically analyzed without major refactoring.

How to Pitch It (Stakeholders)

For Executives: *"Bladestan eliminates production bugs from Blade templates—a common source of support costs and customer friction—by adding static analysis to your existing PHPStan pipeline. For projects using Laravel, this catches undefined variables, missing methods, and broken directives before they reach users, reducing incidents by 30–50%. Why now?

  • Customer trust: Fewer runtime errors mean fewer support tickets and happier users.
  • Cost savings: Reduces firefighting during releases and post-launch fixes.
  • Scalability: Supports faster releases by catching issues early in CI. It’s a zero-cost, high-impact solution that integrates seamlessly with our current tooling. Let’s pilot it on high-risk templates (e.g., checkout flow) and measure the impact."*

For Engineering Leaders: *"Bladestan extends PHPStan to Blade templates, giving us line-accurate error reports with clickable file paths. Key benefits:

  • Fewer production fires: Catch template errors in CI or locally, not in staging.
  • Faster onboarding: New devs won’t break templates accidentally, reducing mentorship overhead.
  • Stronger components: Validate Livewire props and shared data upfront.
  • Zero runtime cost: Runs only in development. Proposal:
  1. Pilot: Enable in CI for critical templates (e.g., dashboard, checkout).
  2. Measure: Track incident reduction and debugging time saved.
  3. Expand: Roll out to all Blade files post-pilot. Risk: Minimal—it’s a dev-only tool with no runtime impact. Reward: More reliable releases and happier developers."*

For Developers: *"Bladestan adds static analysis to Blade templates, so you’ll catch errors like undefined variables or methods before they hit production. Imagine:

  • No more runtime Undefined property errors in Blade.
  • Clickable error links in your IDE when PHPStan flags issues.
  • Faster debugging—no more guessing which template broke. How it works:
  1. Install via Composer (composer require tomasvotruba/bladestan --dev).
  2. Configure PHPStan to include the extension.
  3. Run phpstan analyze --error-format=blade to see template-aware errors. Bonus: Works with Livewire, components, and even mail templates. Let’s make Blade errors a thing of the past!"*
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