spatie/laravel-view-models
View models in Laravel observed · 2026-08-28
Health v2 · maintenance only
72/100
- Activity 85
- Release rhythm 39
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 372
- age_days: 2917
- days_rel: 193
- days_push: 92
- n_releases_24m: 2
Adoption not part of the score
1090 stars · 60 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A Laravel package by Spatie that provides view models: classes that prepare and transform data for views, keeping controllers slim. It offers a simple ViewModel base class to encapsulate view-specific logic.
Use cases
- move view preparation logic out of fat Laravel controllers
- pass structured data objects to Blade views
- organize complex view data like categories and URLs in one class
- replace or complement Laravel view composers
- keep create/edit form controllers clean
When to choose
- you use Laravel and controllers are doing heavy data preparation for views
- you want an alternative to view composers with explicit per-action data
- you prefer object-oriented view data over passing loose arrays
When to avoid
- you don't use Laravel or PHP
- your views are simple and controllers are already thin
- you rely on Blade components or Livewire for view logic
Facets
library · maturity stable
templating middleware web-development backend developer-tools php laravel view-models mvc spatie blade
4 sources
- readme: https://github.com/spatie/laravel-view-models · fetched 2026-08-28 · 963936e3f223
- homepage: https://spatie.be/open-source · fetched 2026-08-29 · 6ed5abf69535
- site_page: https://spatie.be/docs · fetched 2026-08-29 · 08e024d86d95
- site_page: https://spatie.be/about-us · fetched 2026-08-29 · d3cb88e4b34c
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| spatie/laravel-view-models | main | 72 |
For agents
markdown · JSON · MCP: product_card(name="spatie/laravel-view-models")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem