spatie/laravel-view-models
Some data may be outdated — see provenance labels.
View models in Laravel observed · 2026-09-29
Health v2 · maintenance only
66/100
- Activity 77
- Release rhythm 32
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-10-21. Adoption (stars, forks) is never an input.
- gap_med: 372
- age_days: 2965
- days_rel: 241
- days_push: 140
- n_releases_24m: 2
Adoption not part of the score
1092 stars · 60 forks observed · 2026-09-29
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-09-29 · 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 | 66 |
For agents
markdown · JSON · MCP: product_card(name="spatie/laravel-view-models")
Data as of 2026-10-19T08:05:51.212177+00:00 · Report a problem