You're browsing the documentation for an old version of Livewire. Consider upgrading your project to Livewire 2.x.

Artisan Commands

The make command

1php artisan make:livewire foo
2# Creates Foo.php & foo.blade.php
4php artisan make:livewire foo-bar
5# Creates FooBar.php & foo-bar.blade.php
7php artisan make:livewire
8# Creates Foo/Bar.php & foo/bar.blade.php
10php artisan make:livewire foo --inline
11# Creates only Foo.php

Once created, you can render your components in a Blade file with the @livewire('component-name') blade directive.

Think of Livewire components like Blade includes. You can insert @livewire anywhere in a Blade view and it will render.


If you are on Laravel 7 or greater, you can use the tag syntax.

1<livewire:foo />

Modifying Stubs

You can customize the stubs (templates) that Livewire uses to create new component classes and views using the livewire:stubs command.

1php artisan livewire:stubs

The above command will create three files:

  • stubs/livewire.stub
  • stubs/livewire.view.stub
  • stubs/livewire.inline.stub

Now, when you run the make:livewire command, Livewire will use the above stub files as the template.

The move Command

The php artisan livewire:move command will move/rename the component class and blade view, taking care of namespaces and paths

Here is an example of usage:

1php artisan livewire:move foo bar.baz
2# Foo.php|foo.blade.php -> Bar/Baz.php|bar/baz.blade.php
For convenience, livewire:move is aliased to livewire:mv

The copy Command

The php artisan livewire:copy command will create copies of the component class and blade view, taking care of namespaces and paths

Here are a few examples of usage:

1php artisan livewire:copy foo bar
2# Copies Foo.php & foo.blade.php to Bar.php and bar.blade.php
4php artisan livewire:copy foo bar --force
5# Overwrites existing "bar" component
For convenience, livewire:copy is aliased to livewire:cp

The delete Command

The php artisan livewire:delete command will remove the component class and blade view.

Here are a few examples of usage:

1php artisan livewire:delete foo
2# Removes Foo.php & foo.blade.php
4php artisan livewire:delete foo --force
5# Removes without confirmation prompt
For convenience, livewire:delete is aliased to livewire:rm
← Previous Topic

Package Development

Next Topic →

API Reference