Package Development

Registering Custom 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.

        
1class YourPackageServiceProvider extends ServiceProvider {
2 public function boot() {
3 Livewire::component('some-component', SomeComponent::class);
4 }
5}

Now, applications with your package installed can consume your component in their views like so:

        
1<div>
2 @livewire('some-component')
3</div>
← Previous Topic

Troubleshooting

Next Topic →

Artisan Commands