spatie/laravel-view-models
Move complex view-prep logic out of controllers into dedicated Laravel view model classes. Extend Spatie\ViewModels\ViewModel to transform data for views, expose computed properties, and keep templates clean and focused.
Adopt when:
Look elsewhere if:
For Executives: "This package lets us clean up messy controllers and reduce frontend-backend friction by moving view-specific logic into reusable, testable classes. It’s like giving our backend team a ‘cheat sheet’ for the frontend—no more guessing what data the UI needs. For [Project X], this could cut controller refactoring time by 30% and make onboarding new devs 2x faster by separating concerns. It’s a low-risk, high-reward upgrade to our Laravel stack."
For Engineering:
*"Spatie’s laravel-view-models solves the ‘controller as a dumping ground’ problem. Instead of cramming view logic into controllers, we’ll create dedicated classes (e.g., ProductDetailViewModel) that:
How can I help you explore Laravel packages today?