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 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

title: Writing your first component weight: 1

The contents of a component can be stored in a simple Blade view.

{{-- resources/views/components/myAlert.blade.php --}}

<div class="{{ $type }}">
   {{ $message }}
</div>

Before using that component you must first register it. Typically you would do this in the AppServiceProvider boot() method or a service provider of your own

BladeX::component('components.myAlert');

BladeX will automatically kebab-case your Blade view name and use that as the tag for your component. So for the example above the tag to use your component would be my-alert.

If you want to use a custom tag name use the tag-method.

BladeX::component('components.myAlert')->tag('my-custom-tag');

You can also register an entire directory like this.

// This will register all Blade views that are stored in `resources/views/components`

BladeX::component('components.*');

Or you can register multiple directories like this.

// This will register all Blade views that are stored in both `resources/views/components` and `resources/views/layouts`

BladeX::component([
   'components.*',
   'layouts.*',
]);

You can also register sub-directories like this.

// This will register all Blade views that are stored in both `resources/views/components` and `resources/views/layouts`

BladeX::component(
   'components.**.*',
);

In your Blade view you can now use the component using the kebab-cased name:

<h1>My view</h1>

<my-alert type="error" :message="$message" />
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