forked from livewire/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage-dev.blade.php
More file actions
25 lines (20 loc) · 819 Bytes
/
package-dev.blade.php
File metadata and controls
25 lines (20 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
* [Registering Custom Components](#registering-components)
## Registering Custom Components {#registering-components}
You may manually register components using the `Livewire::component` method.
This can be useful if you want to provide Livewire components from a composer package.
Typically this should be done in the `boot` method of a service provider.
@component('components.code', ['lang' => 'php'])
class YourPackageServiceProvider extends ServiceProvider {
public function boot() {
Livewire::component('some-component', SomeComponent::class);
}
}
@endcomponent
Now, applications with your package installed can consume your component in their views like so:
@component('components.code', ['lang' => 'blade'])
@verbatim
<div>
@livewire('some-component')
</div>
@endverbatim
@endcomponent