Mahmoud Al-HabashOpen to new projects
  • WorkWork
  • ServicesServices
  • LabLab
  • WritingWriting
  • ContactContact
Amman--:--عربي
Writing/Livewire

Using Livewire v4 with Volt

Functional API for simpler components.

1 February 20261 min readLivewireاقرأ بالعربية

On this page

  1. Volt Component

Volt provides a functional API for Livewire.

Volt Component

php
<?php
use function Livewire\Volt\{state, rules};

state(['name' => '']);
rules(['name' => 'required|min:3']);

$save = function () {
    $this->validate();
    User::create(['name' => $this->name]);
};
?>

<form wire:submit="save">
    <input wire:model="name">
    <button>Save</button>
</form>
All articles

Keep reading

  • Authorization in Livewire v4 Components1 February 20261 min read
  • Blaze Pre-Compiler: Massive Performance Gains in Livewire v41 February 20261 min read
  • Building a Bookmark Feature with Livewire v41 February 20261 min read