magentron/laravel-blade-lint
Laravel Blade Lint validates Blade templates and reports syntax errors, malformed directives, and other template issues before they reach production. Use its Artisan command locally or in CI to keep views clean and catch mistakes early.
Architecture fit. magentron/laravel-blade-lint is a single-purpose developer tool: an Artisan command that compiles Blade templates to catch syntax-level errors before they reach a rendered page. It sits in the same architectural slot as php -l, PHPUnit, or Pint — a dev-only, run-and-exit quality gate. It does not touch the request lifecycle, the container, service providers in production, or the data layer. That makes it a low-coupling addition: worst case it is removed with composer remove --dev and zero production impact. Fit is highest for teams with large resources/views trees, heavy use of @include/@component/@each, and no existing view-compilation step in CI.
Integration feasibility. Expected path is composer require --dev magentron/laravel-blade-lint, then invoking the command in CI. The main feasibility question is not "can we install it" but "does it resolve views correctly" — Blade linting requires bootstrapping enough of the Laravel application to locate view paths, namespaces (view()->addNamespace), and registered custom directives. Anything that requires a full app boot (database, cache, config from env) is an integration constraint we must validate early. Verify: supported Laravel/PHP version matrix, whether it lints by path glob or by view name, exit code semantics, and output format (plain text vs. machine-readable for CI annotations).
Technical risk.
composer.lock.@include of a nonexistent view if resolution is name-based. Do not let it be mistaken for view test coverage.Key questions for the maintainer / spike.
Stack fit. Assumes a standard Laravel app with Composer, Artisan, and a CI runner that already executes PHP tooling. No runtime dependency, no service, no infrastructure. It slots next to existing static-analysis steps and requires no change to application code, config, or deployment topology.
Migration path. Effectively greenfield — there is no incumbent to migrate from unless we are replacing an ad-hoc view:cache smoke step or a hand-rolled Blade::compileString script. Recommended sequence:
composer lint:blade) and optionally a pre-commit hook so failures surface before the push, not after.Compatibility. Two axes to confirm: Laravel major (Blade compiler internals shift between majors) and PHP minor. Pin the package version and re-run the spike as part of every Laravel upgrade checklist — that is the moment this class of tool breaks. Also confirm behavior under view:cache and with compiled views present, and that it tolerates @php blocks, nested components, and inline templates.
Sequencing relative to other work. Land it before a Blade-heavy refactor (component extraction, layout consolidation) so the refactor has a safety net; land it after any in-flight view rewrites to avoid attributing new failures to the tool. Independent of release trains — no customer-facing surface.
Maintenance. Near-zero steady state: a version pin, a CI step, and an entry on the Laravel-upgrade checklist. The real cost is the exception list — every custom directive or legitimate-but-unlintable construct that produces a false positive needs a documented carve-out, or engineers will start ignoring the step. Assign one owner (typically the platform/tooling engineer) so pins and carve-outs do not rot.
Support. No vendor, no SLA. Support model is "we own the fork if it breaks." Budget a realistic half-day to patch or vendor a one-line fix if the maintainer goes dark mid-upgrade — which, at 16 stars, is a plausible scenario. Keep the dependency dev-only so an unpatched break never blocks a production deploy.
Scaling. Trivial. Runtime is proportional to view count and is a pure CPU/parse workload — sub-minute for most applications, low-minutes for very large trees. If it becomes slow, shard by directory or restrict to changed files in PR pipelines. No concurrency, memory, or state concerns.
Failure modes.
Ramp-up. Minutes. One command, one CI line, one README note. No training program, no on-call implications, no runbook beyond "if it's red, fix the Blade syntax or add an exemption."
Recommendation. Adopt as an advisory-to-blocking dev-only check provided legal clears GPL-3.0 for our distribution model and the spike shows an acceptable false-positive rate on our custom directives. If either gate fails, the same outcome is achievable with a ~30-line in-house Artisan command wrapping Blade::compileString over resources/views — MIT-clean, fully owned, and adequate for the syntax-check job this package performs.
How can I help you explore Laravel packages today?