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
Laravel Blade X

Laravel Blade X Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Use custom HTML components in your Blade views

Frequently asked questions about Laravel Blade X
Can I use spatie/laravel-blade-x in Laravel 7 or 8 for better component syntax?
No, this package is explicitly for Laravel 6 and below. Laravel 7+ introduced native Blade components (`<x-my-alert />`), which replace Blade-X functionality. Migrate to native components when upgrading Laravel.
How do I install and register Blade-X components in Laravel 6?
Run `composer require spatie/laravel-blade-x`—the package auto-registers. Define components as Blade files in `resources/views/components/` (e.g., `alert.blade.php`) and use them in views with `<alert type="error" />`.
Does Blade-X support dynamic props like `:message="$var"` in Laravel 6?
Yes, Blade-X supports dynamic props with `:prop="$variable"` syntax. For example, `<alert :message="$error" />` passes the `$error` variable to the component’s Blade file as `$message`.
Will this package break when upgrading Laravel 6 to 7?
Yes, Blade-X is incompatible with Laravel 7+. You’ll need to manually convert components from `<my-alert />` to `<x-my-alert />` syntax. Plan for this migration before upgrading.
Are there alternatives to Blade-X for Laravel 6 if I need component-like syntax?
For Laravel 6, Blade-X is the most straightforward option. Alternatives include custom Blade directives or sticking with `@include()` directives, though they lack the HTML-like syntax. No maintained packages replicate Blade-X’s functionality for Laravel 6.
Can I use Blade-X with Tailwind CSS or Livewire in Laravel 6?
Absolutely. Blade-X components work seamlessly with Tailwind CSS for styling and Livewire for interactivity. For example, a Livewire component can render Blade-X markup like `<livewire-alert />` for dynamic UI.
Is Blade-X secure for production use in Laravel 6?
Blade-X itself is secure, but since it’s abandoned, ensure your Laravel 6.x version is patched for vulnerabilities. Avoid long-term use—migrate to Laravel 7+ for ongoing security updates and native Blade components.
How do I test Blade-X components in Laravel 6?
Test components by rendering them in Blade views and asserting output in PHPUnit. Use `Blade::render()` to test component markup directly. Example: `$html = Blade::render('<alert type="success" />'); $this->assertStringContainsString('success', $html);`
Does Blade-X support nested components like Vue/React?
No, Blade-X components are static and don’t support nesting or dynamic slots like Vue/React. Each component is a standalone Blade file. For complex nesting, consider upgrading to Laravel 7+ native components or using JavaScript frameworks.
What’s the performance impact of Blade-X vs. native `@include()` in Laravel 6?
Blade-X adds minimal overhead—it’s essentially a syntax wrapper for `@include()`. Both are compiled to PHP, so performance differences are negligible. Use Blade-X for cleaner syntax, not performance gains.
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