Menu

Laravel 13 Puts #[Table] on Your Models. PHP Won't Load That Class Until newInstance()
πŸ“°

Laravel 13 Puts #[Table] on Your Models. PHP Won't Load That Class Until newInstance()

DEV Community: laravelΒ·Gabriel AnhaiaΒ·16 days ago
#l6w1AhTN
#devtolaravel#devto#dev#class#attribute
Long article (1777 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Book: Decoupled PHP β€” Clean and Hexagonal Architecture for Applications That Outlive the Framework

Also by me: Thinking in Go (2-book series) β€” Complete Guide to Go Programming + Hexagonal Architecture in Go

My project: Hermes IDE | GitHub β€” an IDE for developers who ship with Claude Code and other AI coding tools

Me: xgabriel.com | GitHub

Your domain package has its own composer.json , no Laravel in require , and a test suite that runs green without the framework installed. Then a pull request adds one line above an entity: #[Table('orders')] , with a use Illuminate\Database\Eloquent\Attributes\Table; at the top. The tests still pass. The class still loads. Nothing in PHP complains, because PHP never looks at that attribute class unless someone asks it to.

Laravel 13 , released on March 17, 2026 with PHP 8.3 as the minimum, puts more of the framework's configuration into attributes. That makes this case worth understanding.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.