Making Components

The make Command

It is highly recommended that you use the php artisan make:livewire command for all new components.

Here are a few examples of usage:

# Creates Foo.php & foo.blade.php
php artisan make:livewire foo

# Creates FooBar.php & foo-bar.blade.php
php artisan make:livewire foo-bar

# Creates Foo/Bar.php & foo/bar.blade.php
php artisan make:livewire foo.bar
For convenience, make:livewire is aliased to livewire:make and livewire:touch

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:

# Moves Foo.php & foo.blade.php to Bar/Baz.php and bar/baz.blade.php
php artisan livewire:move foo bar.baz
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:

# Copies Foo.php & foo.blade.php to Bar/Baz.php and bar/baz.blade.php
php artisan livewire:copy foo bar.baz

# Copies Foo.php & foo.blade.php to Bar.php and bar.blade.php
# (overwriting existing Bar.php and bar.blade.php)
php artisan livewire:copy foo bar --force
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:

# Removes Foo.php & foo.blade.php (with confirmation prompt)
php artisan livewire:delete foo

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

Installation

Next Topic →

The render() Method