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

Artisan Commands

Be amazing at Livewire
with our in-depth screencasts.
Watch Now

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 Foo
8# Creates Foo.php & foo.blade.php
10php artisan make:livewire FooBar
11# Creates FooBar.php & foo-bar.blade.php
13php artisan make:livewire
14# Creates Foo/Bar.php & foo/bar.blade.php
16php artisan make:livewire foo --inline
17# Creates only Foo.php
19php artisan make:livewire foo --test
20# Creates Foo.php, foo.blade.php, & FooTest.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, blade view and the component test if it exists, 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|FooTest.php -> Bar/Baz.php|bar/baz.blade.php|Bar/BazTest.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
7php artisan livewire:copy foo bar --test
8# Copies Foo.php & foo.blade.php & FooTest.php to Bar.php & bar.blade.php & BarTest.php
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
7php artisan livewire:delete foo --test
8# Removes Foo.php & foo.blade.php & FooTest.php
For convenience, livewire:delete is aliased to livewire:rm
← Previous Topic Package Development
Next Topic → Contribution Guide