PHPackages                             tychovbh/laravel-mvc - 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. [Framework](/categories/framework)
4. /
5. tychovbh/laravel-mvc

ActiveLibrary[Framework](/categories/framework)

tychovbh/laravel-mvc
====================

Add mvc structure to laravel

v3.3(5y ago)12.9k[1 PRs](https://github.com/tychovbh/laravel-mvc/pulls)MITPHPPHP ^7.1.3CI failing

Since Nov 8Pushed 3y ago2 watchersCompare

[ Source](https://github.com/tychovbh/laravel-mvc)[ Packagist](https://packagist.org/packages/tychovbh/laravel-mvc)[ Docs](https://github.com/tychovbh/laravel-mvc)[ RSS](/packages/tychovbh-laravel-mvc/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (18)Versions (36)Used By (0)

laravel-mvc
===========

[](#laravel-mvc)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f6ecf6a057ace344e574e14e5bbf28b85865e4581b7d0482b028bf93490320e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f747963686f7662682f6c61726176656c2d6d76632e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tychovbh/laravel-mvc)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/d6d3ba92098f52d7c241b63e8f01a009445b8fc7c7521e9b8c07ae4d1c4eb33a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f747963686f7662682f6c61726176656c2d6d76632e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tychovbh/laravel-mvc)

Laravel MVC is created by, and is maintained by Tycho, and is a Laravel/Lumen package to manage all your data via a Repository. Feel free to check out the [change log](CHANGELOG.md), [releases](https://github.com/tychovbh/laravel-mvc/releases), [license](LICENSE.md), and [contribution guidelines](CONTRIBUTING.md)

Install
-------

[](#install)

Via Composer

```
$ composer require tychovbh/laravel-mvc
```

For lumen application add Service Provider to bootstrap/app.php

```
$app->register(\Tychovbh\Mvc\MvcServiceProvider::class);
```

Usage
-----

[](#usage)

### Repositories

[](#repositories)

Create a Repository:

```
// Creates a repository in app/Repositories
artisan mvc:repository UserRepository

```

Use The UserRepository in controller, but you can use it anywhere else too.

```
class UserController extends AbstractController
{
    public function __construct(UserRepository $repository)
    {
        $this->repository = $repository
    }

    public function index()
    {
        $users = $this->repository->all();
        return response()->json($users)
    }
}
```

Make sure you have a Model that your repository can use. If you want to use save/update methods add $filled to your model.

```
class User extends model
{
    protected $filled = ['name']
}
```

Available methods"

```
// Get all
$this->repository->all();

// Search all resources where name: Jan
$this->repository::withParams(['name' => 'Jan'])->get();

// Search all resources where name: Jan and get first.
$this->repository::withParams(['name' => 'Jan'])->first();

// Search all resources where names in: Jan and piet
$this->repository::withParams(['name' => ['jan', 'piet']])->get();

// Order all resources by name or any other Laravel statement
$this->repository::withParams(['sort' => 'name desc')]->get();

// Paginate 10
$this->repository->paginate(10);

// Paginate 10 where country in Netherlands or Belgium.
$this->repository::withParams(['country' => ['Netherlands', 'Belgium']])->paginate(4);

// Search resource with ID: 1
$this->repository->find(1);

// Store resource in the database. This uses laravel fill make sure you add protected $filled = ['name'] to your User model.
$user = $this->repository->save(['name' => 'jan']);

// Update resource.
$user = $this->repository->update(['name' => 'piet'], 1);

// Destroy resource(s).
$this->repository->destroy([1]);
```

If you wish to override on of the methods above just add it to you repository

```
class UserRepository extends AbstractRepository implements Repository
{
    public function find(int $id)
    {
        // add your own implementation of find
        return $user;
    }

    public function save($data)
    {
        // Add some logic and then call parent save
        $data['password'] = Hash:make($data['password']);
        return parent::save($data);
    }

    // You can add your own custom params to filter the request
    // This will be triggered when key is "search" is added to the params:
    // Let's say we want to build a search on firstname, lastname and email:
    // $repository->params(['search' => 'jan'])->all();
    // $repository->params(['search' => 'jan@gmail.com'])->all();
    // $repository->params(['search' => 'piet'])->all();
    // We can do that by adding a method, just capitalize the param key and add index{key}Param to the method name.
    public function indexSearchParam(string $search)
    {
        $this->query->where('email', $search)
                    ->orWhere('firstname', $search)
                    ->orWhere('surname', $search);
    }

    // You can do the same for show methods like find
    public function showSearchParam(string $search);
}
```

### Controllers

[](#controllers)

Create a Controller:

```
// Creates a Controller in app/Http/Controllers
artisan mvc:controller UserController

```

All Laravel Resource methods are now available (index, show, store, update, destroy). See their documentation here for setting up routes: [laravel resource controllers](https://laravel.com/docs/5.8/controllers#resource-controllers).

You can override Resource methods to do project related stuff

```
class UserController extends AbstractController
{
    public function index()
    {
        // Do stuff before querying

        $response = parent::index();

        // Do stuff after querying

        return $response;
    }
}
```

### Form Requests

[](#form-requests)

Create a Form Request:

```
// Creates a Form Request in app/Http/Requests
artisan mvc:request StoreUser

```

You can use the request middleware "valdiate" to validate the request. It will look for the FormRequest and validate it So for example model User:

- store request (POST /users) will look for a FormRequest with name StoreUser
- update request (UPDATE /user/{id}) will look for a FormRequest with name UpdateUser

```
// routes/web.php (Laravel)
$router->post('/users', 'UserController@index')
->name('user.index')
->middleware('validate');

// routes/web.php (Lumen)
$router->post('/users', [
    'middleware' => 'validate',
    'as' => 'users.index',
    'uses' => 'UserController@index'
]);
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Tycho](https://github.com/tychovbh)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 67.4% 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 ~40 days

Recently: every ~102 days

Total

30

Last Release

1636d ago

Major Versions

v0.9 → v1.02019-03-29

v1.9 → v2.02019-05-13

v2.5 → v3.02020-11-26

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18251477?v=4)[bespokeweb](/maintainers/bespokeweb)[@bespokeweb](https://github.com/bespokeweb)

---

Top Contributors

[![tychovbh](https://avatars.githubusercontent.com/u/5880561?v=4)](https://github.com/tychovbh "tychovbh (227 commits)")[![thvrijn](https://avatars.githubusercontent.com/u/64139584?v=4)](https://github.com/thvrijn "thvrijn (85 commits)")[![merkendiep](https://avatars.githubusercontent.com/u/48518126?v=4)](https://github.com/merkendiep "merkendiep (25 commits)")

---

Tags

tychovbhlaravel-mvc

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/tychovbh-laravel-mvc/health.svg)

```
[![Health](https://phpackages.com/badges/tychovbh-laravel-mvc/health.svg)](https://phpackages.com/packages/tychovbh-laravel-mvc)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M146](/packages/laravel-cashier)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)

PHPackages © 2026

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