Before Livewire, building dynamic UIs in a Laravel application meant reaching for Vue.js, React, or writing AJAX requests by hand. Livewire removes that requirement.Livewire is a Laravel package that lets you build reactive, interactive components entirely in PHP and Blade. Real-time form validation, live search, counters, and modals — everything that previously needed JavaScript can now be written in PHP.
Livewire 4 requires Laravel 10 or higher and PHP 8.1 or higher.
A Livewire component is a PHP class combined with a Blade template. When a user clicks a button or types in an input, Livewire sends an AJAX request in the background, runs the PHP logic, and updates only the changed parts of the page. You write pure PHP — Livewire handles the rest.
Generate a component using Artisan. Let’s build a simple counter:
php artisan make:livewire Counter
This creates a single-file component at resources/views/livewire/counter.blade.php. Edit it to look like this:
<?phpuse Livewire\Component;new class extends Component { public int $count = 0; public function increment(): void { $this->count++; } public function decrement(): void { $this->count--; }};?><div> <h1>Count: {{ $count }}</h1> <button wire:click="increment">+1</button> <button wire:click="decrement">-1</button></div>
Embed the component in any Blade template:
<livewire:counter />
Every button click updates the count without a page reload. wire:click wires a DOM event directly to a PHP method — no JavaScript required on your end.
$this->validate() validates all properties at once on form submission. Using it alongside #[Validate] attribute-level validation gives you a two-step approach: per-field validation on blur, and full validation on submit.
Pair wire:model.live.blur with #[Validate] to display error messages the moment a user leaves an invalid input — without a page reload.
If you already know Blade, you can start using Livewire today. There is no JavaScript framework to learn.
For experiences that require SPA-level interactivity with a full JavaScript UI framework, Inertia.js is a better fit. But for forms, admin panels, and data tables, Livewire often results in simpler, more maintainable code. Start with a single small component and expand from there.
Livewire documentation
Full coverage of file uploads, pagination, testing, Alpine.js integration, and more.