The biggest developer facing improvement regarding PHP Attributes in Laravel 12 & Laravel 13 is the introduction of native, first-class support for PHP Attributes across numerous parts of the framework . This allows you to configure behavior directly on your classes using inline attributes, rather than relying on traditional class properties or separate configuration files.
Key Aspects of This Improvement
Widespread Application: This isn not just for one feature. Attributes are now supported in 15+ locations, including Eloquent Models, Queue Jobs, Console Commands, Controllers, and more .
Cleaner, More Declarative Code: You can now define things like a model is table name, hidden fields, or a job is retry limits right above the class declaration. This keeps configuration co-located with the code it affects, making it more readable and expressive .
Fully Optional and Backward Compatible: This is a non-breaking change. You can continue using traditional properties if you prefer, and existing applications will work without modification .
Quick Example
Instead of defining $table, $hidden, and $fillable properties inside your model, you can now do this:
#[Table( users , key: user_id , keyType: istring , incrementing: false)]
#[Hidden([ password ])]
#[Fillable([ name , email ])]
class User extends Model {}
Similarly, for a queued job, you can define its queue and retry settings directly:
#[Queue( podcasts )]
#[Tries(3)]
#[Timeout(120)]
class ProcessPodcast implements ShouldQueue {}
This shift towards a declarative, attribute-first approach is considered the most significant developer-experience upgrade in this release .