Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jfranc014's avatar

Livewire 3. 5 attributes not working in Sail?

Hi. I'm following the Livewire docs and want to set up a page title using the attribute syntax #[Title('Create Post')] , like the following example.

<?php

namespace App\Livewire;

use Livewire\Component;
use App\Models\User;



#[Title('Users Listing')] 
class UsersListing extends Component
{
    public function render()
    {
        $users = User::all();

        return view('livewire.users-listing')->with(['users' => $users]);
    }
}

But the title doesn't change, and I think the attribute is not applied at all. I'm using Laravel Sail which has installed PHP 8.3. The Livewire library 3.5 is also installed. Is there any config file to edit to enable attributes in Livewire component classes?

0 likes
1 reply
jfranc014's avatar

I found out the Title attribute class has to be imported before being able to use them. use Livewire\Attributes\Title;

My mistake not seeing it in the docs examples. I believed they are autoloaded. Sorry.

Please or to participate in this conversation.