
Laravel 13 PHP Attributes: Refactor Your Models, Jobs, and Commands in 10 Minutes
Originally published at hafiz.dev Every Laravel model you've ever written starts the same way. A wall of protected arrays sitting above your actual business logic. $fillable , $hidden , $guarded , $table , $connection . You know the drill. I counted my last project. 23 models. Every single one had at least four property declarations before the first method. Some had eight or nine. That's not configuration. That's clutter. Laravel 13 changes that. Dropping March 17, PR #58578 introduces PHP 8 Attributes as a first-class alternative to class properties across your entire application. Models, queue jobs, artisan commands, form requests, even API resources and factories. And the best part? It's completely non-breaking. Your existing code works exactly as before. But here's what nobody's showing you: how to actually take an existing Laravel app and start using these attributes once you upgrade. Not a feature list. Not a changelog recap. A practical, "open your editor and do this" guide. Let
Continue reading on Dev.to Tutorial
Opens in a new tab




