PHPackages                             hosseinsheikh/smart-view-model - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. hosseinsheikh/smart-view-model

ActiveLibrary[Templating &amp; Views](/categories/templating)

hosseinsheikh/smart-view-model
==============================

smart view model

v3.0.0(2y ago)2789MITPHPPHP ^8.0.2

Since Sep 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hosseinsheikh-web/smart-view-model)[ Packagist](https://packagist.org/packages/hosseinsheikh/smart-view-model)[ RSS](/packages/hosseinsheikh-smart-view-model/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (15)Used By (0)

[![](https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg)](https://laravel.com)

***Smart View Model***
======================

[](#smart-view-model)

- To use this pattern, you can do the following
    - Make controller and view model:

        ```
          php artisan vm:make-controller {controller name}
          php artisan vm:make-controller {controller name} --namespace={defin special namespace for viewmodel}
          php artisan vm:make-viewmodel {view model name} --controller={controller name}
          php artisan vm:make-viewmodel {view model name} --controller={controller name} --namespace={defin special namespace for viewmodel}

        ```
    - Controller method structure:

        ```
           // view model puts in ViewModel/Hossein namespace
           // view model name is IndexViewModel
            public function index()
            {
                return \SmartViewModel::addItems([])
                    ->throughViewModel('hossein.index')
                    ->thenReturn();
            }

          // view model puts in Malekkhatoon/Ahmad/ViewModel/Hossein namespace
          // view model name is IndexViewModel
          public function index()
          {
              return \SmartViewModel::addItems([])
                  ->throughViewModel('hossein.index')
                  ->setNameSpace('malekhatoon.ahmad')
                  ->thenReturn();
          }

          // You can use this instead of the top
          public function index()
          {
              return \SmartViewModel::addItems([])
                  ->through(Malekkhatoon\Ahmad\ViewModel\Hossein\IndexViewModel::class)
                  ->thenReturn();
          }

        ```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~47 days

Recently: every ~5 days

Total

14

Last Release

1077d ago

Major Versions

v1.0 → v2.02022-03-09

v2.2.2 → v3.0.02023-05-30

PHP version history (2 changes)v1.0PHP ^7.4|^8.0

v2.0.1PHP ^8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6552c7286136cbd607f9f63332668e9172d356b2e772268b0978a89466bcab24?d=identicon)[hosseinsheikh.web](/maintainers/hosseinsheikh.web)

---

Top Contributors

[![hosseinsheikh-web](https://avatars.githubusercontent.com/u/38690344?v=4)](https://github.com/hosseinsheikh-web "hosseinsheikh-web (36 commits)")

---

Tags

phplaravellaravel-packagelaravel8laravel8-packagelaravel-view-modellaravel-smart-view-modellaravel8-smart-view-modellaravel8-view-modellaravel9-view-model

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hosseinsheikh-smart-view-model/health.svg)

```
[![Health](https://phpackages.com/badges/hosseinsheikh-smart-view-model/health.svg)](https://phpackages.com/packages/hosseinsheikh-smart-view-model)
```

###  Alternatives

[andreia/filament-nord-theme

A minimalist Arctic Nord theme for FilamentPHP

13334.7k2](/packages/andreia-filament-nord-theme)[yorcreative/laravel-argonaut-dto

Argonaut is a lightweight Data Transfer Object (DTO) package for Laravel that supports nested casting, recursive serialization, and validation out of the box. Ideal for service layers, APIs, and clean architecture workflows.

1062.8k1](/packages/yorcreative-laravel-argonaut-dto)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
