New in Laravel 13: Added 36 (!) PHP Attributes

Laravel Daily| 00:05:02|Mar 19, 2026
Chapters14
Introduces Laravel 13 and the abundance of PHP attributes available, noting that many are optional.

Laravel 13 brings 36 new PHP attributes, offering optional, readable alternatives for common tasks like middleware, authorization, and model properties.

Summary

Laravel Daily’s video dives into the new PHP attributes introduced in Laravel 13, highlighting that there are 36 total attributes you can use. Mikel, the host, stresses that attributes are optional and that developers can stick with the classic syntax if they prefer. He demonstrates practical examples across Eloquent, queue jobs, console commands, and routing/controller configuration, such as using attributes for fillable/hidden/appends, Q Job timing with backoff, and controller middleware or authorization atop the class. The host notes that starter kits may surface these attributes by default, especially with Laravel 13’s skeleton and two-factor authentication in starter kits like Livewire. He also points to a comprehensive list on Laravel Daily’s site, which compiles all the new attributes and pre-existing ones before Laravel 13. The overall message: attributes are a flexible, optional enhancement, not a forced paradigm shift, and you can adopt them gradually based on readability and team preference.

Key Takeaways

  • Laravel 13 includes 36 new PHP attributes and a detailed list is available on Laravel Daily’s site (linked in the description).
  • Attributes are optional in Laravel 13; developers can continue using classic syntax if they prefer.
  • Fillable/hidden/appends can be expressed with attributes on models instead of Eloquent properties.
  • Queue-related attributes like timeout and backoff can simplify Q Job configuration by placing settings atop the class.
  • Controller and routing attributes (e.g., middleware and authorize) offer an alternative to property-based definitions, though readability may vary by team.
  • Console command metadata can be declared with attributes for signature and description, replacing the traditional class properties.
  • Starter kits (including Livewire) may showcase attributes by default, highlighting their practical adoption potential.

Who Is This For?

Laravel developers curious about Laravel 13’s new PHP attributes and teams weighing whether to adopt attribute syntax or stick to traditional definitions. This is especially useful for those updating starter kits, working with Eloquent models, queues, and console commands.

Notable Quotes

"Hello guys, one of the new features of Laravel 13 new version is a lot of new PHP attributes like middleware, like authorize and others."
Intro framing the main feature: PHP attributes in Laravel 13.
"Important thing, this is optional. So you can still use old syntax if you don't like PHP attributes."
Emphasizing the optional nature of attributes.
"Laravel is famous for being optional in whatever you want to use"
Supporting the overall flexibility and philosophy.
"So instead of doing these on eloquent you can do something like this."
Demonstrating model attribute syntax shift.
"Will you use PHP attributes whenever you can or it depends?"
Engaging viewers to weigh adoption.

Questions This Video Answers

  • How do PHP attributes compare to traditional Laravel configuration in Laravel 13?
  • What are the 36 new PHP attributes in Laravel 13 and which ones are most practical for daily tasks?
  • Can I gradually adopt Laravel 13 attributes in an existing project without a full refactor?
  • Do starter kits like Laravel Breeze or Jetstream support PHP attributes out of the box?
  • What are best practices for readability when using attributes on controllers and models?
Laravel 13PHP AttributesLaravel DailyEloquent attributesMiddleware attributesAuthorize attributesQueue job attributesConsole command attributesRouting attributesController attributes
Full Transcript
Hello guys, one of the new features of Laravel 13 new version is a lot of new PHP attributes like middleware, like authorize and others. But I didn't realize how many of them there are. So after checking the source code, I found 36 new attributes and listed them on the website on Laravel Daily. So I will link that list in the description below. And in this video, I will show you kind of the most important and the most interesting ones you may want to use. Important thing, this is optional. So you can still use old syntax if you don't like PHP attributes. For example, a few weeks ago when the news came out that there will be new attributes, I posted this on YouTube and 300 people liked this post about upcoming PHP attributes. But also there were these people with comment WTF and 57 likes. So yeah, not all of people like PHP attributes and that is fine. Laravel is famous for being optional in whatever you want to use like react view or livewire even for starter kit now with swelt as well. So yeah, PHP attributes are optional. That said, they are in the starter kits. So for example in yesterday's video I installed new Laravel project with Laravel 13 and the default user model now looks like this. So instead of eloquent properties of fillable and hidden now we have attributes on top. So this comes with the skeleton of Laravel Laravel here's the user model whether you want it or not. Of course, you may change that to properties if you want manually, but by default, Laravel will suggest these. And same with other starter kits like LiveWire starter kit, for example, user model has the same and even more actually hidden properties values because in the starter case, there's also two factor authentication. So, there are more hidden properties. And now, let's take a look what other interesting attributes we have in the new Laravel 13. I will zoom that in. And fillable. You saw that already. So this is fillable before now it can be done with attributes. So fillable guarded the opposite and then you can do just unguarded instead of guarded empty something like this also you already saw hidden. So a few eloquent hidden and visible as well. Eloquent properties like appends can be now properties also this is the interesting one table becomes attribute with a lot of things inside options. So instead of doing these on eloquent you can do something like this. This is how it looks in the framework. So there's eloquent attribute table and these are the properties of the constructor. Okay. Next I want to show a few Q job attributes. So tries instead of property you can do tries on top as attributes. So you see the pattern. It's nothing really fancy. It's just the same names on top if you prefer to do it that way. So timeout becomes timeout on top with back off. This is interesting. You can do something like this exponential backoff. Also a few attributes about console commands, artisan commands. So signature instead of this can be this and description as well on top instead of property of the class. Also there are attributes for routing and controller. So middleware instead of doing this you can do this on top of controller class or you can do even this. I'm not sure I'm a big fan of that because it's hard to read, I guess. Or maybe my eyes are not just used to that, but maybe it's a new preference for people. We'll see how many people will actually adopt this. Also, authorize, you can do something like this on top of controller class. A few more interesting random attributes. Seed will run the default cedar for test class. I'm not even sure if you knew about that property existence. So now it can be attribute as well or you can specify to run specific cedar like this. But perhaps more useful and practical is this setup. So instead of running setup and parent setup, you can do shorter way like this. Well, it's not necessarily shorter because it's a separate method, but you don't need to call parent setup specifically. And also in that article, I listed pre-existing attributes before Laravel 13. So maybe some of them will be new to you as well. So observed by instead of generating observer and registering it in the service provider. There's also scoped by collected by also use factory if it's not a default factory and so on. So all of that list will be in the article. I will link that in the description below. So what do you feel about this new change? It's not even a change. It's an optional new syntax. Will you use PHP attributes whenever you can or it depends? Let's discuss all of that in the comments below.

Get daily recaps from
Laravel Daily

AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.