Laravel

Livewire URL Query Parameters: Shareable States

December 24, 2025 1 min read 35 views

Sync state with URL:

Define URL Parameters

use Livewire\Attributes\Url;

class SearchPosts extends Component
{
    #[Url]
    public $search = '';

    #[Url]
    public $category = 'all';
}

Keep History

#[Url(history: true)]
public $page = 1;

Custom Parameter Name

#[Url(as: 'q')]
public $search;

Users can bookmark and share filtered states!

Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!