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

URL Query String Binding in Livewire v4

Sync component state with URL query parameters.

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

On this page

  1. Basic Usage
  2. URL Result

Livewire v4 can sync properties with URL query strings.

Basic Usage

php
use Livewire\Attributes\Url;
use Livewire\Component;

class ProductList extends Component
{
    #[Url]
    public string $search = '';
    
    #[Url(as: 'page')]
    public int $currentPage = 1;
    
    #[Url(history: true)]
    public string $tab = 'overview';
}

URL Result

/products?search=laptop&page=2&tab=reviews
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