spatie/laravel-blade-x
Blade-X brings Blade-style HTML components to Laravel 6 and below, letting you use tags like instead of @include. Package is abandoned because Laravel 7+ has native Blade components; migrate when upgrading.
@include directives.@include patterns.<my-alert> instead of @include('myAlert')).<x-my-alert> instead of <my-alert>).@props, slots), making this package a technical debt rather than a solution.@include?
<component> syntax is low-risk and high-reward for readability.@include directives to identify reusable components (e.g., alerts, buttons, cards).composer require spatie/laravel-blade-x
@include('component', ['prop' => $value]) with <component prop="$value" />.<!-- Before -->
@include('alert', ['type' => 'error', 'message' => $message])
<!-- After -->
<alert type="error" :message="$message" />
resources/views/components/alert.blade.php) follow the Blade-X structure:
@props(['type' => 'info', 'message'])
<div class="alert alert-{{ $type }}">{{ $message }}</div>
:message), default values, and edge cases (e.g., missing props).@directive usage.config/app.php.php artisan view:cache).@include with <component> syntax.@slot directives), but lacks advanced features like dynamic components or inheritance.| Risk | Mitigation Strategy |
|---|---|
| Package Abandonment | Fork the repo or migrate to native components before Laravel 6 EOL. |
| Syntax Conflicts | Avoid naming components the same as HTML tags (e.g., <table>). |
| Upgrade Blockers | Document component usage in a migration checklist for Laravel 7+. |
| Security Vulnerabilities | Pin the package version (composer require spatie/laravel-blade-x:^1.0) and monitor Laravel 6.x updates. |
| Team Resistance | Conduct a proof-of-concept with a small team before full adoption. |
@props, :prop binding).@include to <component>.How can I help you explore Laravel packages today?