fortephp/sheath-blade-compiler

Laravel Blade compiler diagnostics for the Sheath template linter.

Maintainers

Package info

github.com/fortephp/sheath-blade-compiler

pkg:composer/fortephp/sheath-blade-compiler

Transparency log

Fund package maintenance!

johnathonkoster

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-08-24 02:26 UTC

This package is auto-updated.

Last update: 2026-08-24 02:29:24 UTC


README

Catch PHP errors in compiled Blade templates before they reach production.

This Sheath plugin compiles your Blade views and checks the generated PHP for syntax and compile-time errors. It supports your application's custom directives and components without rendering views or executing their PHP.

Installation

composer require --dev fortephp/sheath-blade-compiler

Laravel discovers the package automatically. Add its preset to config/sheath.php:

'preset' => ['recommended', 'blade-compiler'],

Then run Sheath normally:

php artisan sheath:lint

You can also try the plugin without changing your config:

php artisan sheath:lint --preset=blade-compiler

What it catches

  • malformed Blade directives and echoes;
  • invalid PHP emitted by custom directives or compiler hooks;
  • component compilation failures;
  • PHP compile-time errors such as illegal break statements and duplicate imports;
  • syntax errors inside @php blocks and native PHP tags.

Errors are reported in your Blade view rather than generated PHP, so they are easier to find and fix.

By default, the plugin starts a separate PHP process to check each compiled view. This catches compile-time errors that a simpler in-process parser can miss. If your environment does not allow PHP processes, use parser mode instead:

'rules' => [
    'blade-compiler-valid-output' => ['error', [
        'phpValidation' => 'parser',
    ]],
],

Requirements

  • PHP 8.2 or newer
  • Laravel 12 or 13
  • Sheath 1.x

License

MIT. See license.md.