PHPackages                             ymslavov/laravel-repository - 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. [Database &amp; ORM](/categories/database)
4. /
5. ymslavov/laravel-repository

ActiveLibrary[Database &amp; ORM](/categories/database)

ymslavov/laravel-repository
===========================

Stateful repositories for Laravel models.

3.0(9y ago)01.4kMITPHPPHP &gt;=5.6.4

Since Jan 12Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ymslavov/laravel-repository)[ Packagist](https://packagist.org/packages/ymslavov/laravel-repository)[ RSS](/packages/ymslavov-laravel-repository/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (9)Used By (0)

Stateful Repository Implementation
==================================

[](#stateful-repository-implementation)

Based on the work featured in [bosnadev.com](https://bosnadev.com/2015/03/07/using-repository-pattern-in-laravel-5/), but with a few additional helpful methods for multi-record operations.

Laravel 5.3+ required.

Installation via Composer
-------------------------

[](#installation-via-composer)

```
composer require ymslavov/laravel-repository

```

Using Repository Generators
---------------------------

[](#using-repository-generators)

The package provides an easy way to generate repository classes for all models in the system.

All you need to do is register the service provider in your config/app.php in the 'providers' array:

```
'providers' => [
    ...other providers here...,
    YasenSlavov\LaravelRepository\Providers\LaravelRepositoryServiceProvider::class
]

```

And then use the following command in your command line tool:

```
php artisan repositories:generate

```

The script will scan the app/ directory for any classes that extend the Eloquent Model class and create repository classes for them.

Extending the AbstractRepository directly
-----------------------------------------

[](#extending-the-abstractrepository-directly)

If you prefer not to use the auto-generated classes, you can simply extend the AbstractRepository class directly from the package.

Example:

```
class UsersRepository extends AbstractRepository {
  /**
     * Specify the fully-qualified model name. Best use Classname::class
     *
     * @return string
     */
    function model()
    {
        return User::class;
    }
}

$usersRepo = \App::make(UsersRepository::class);

$usersWithTitleManager = $usersRepo
                            ->clearScope() //clear any state already established in the repo object
                            ->pushCriteria(new ByRoleTitle('Manager'))
                            ->all();

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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 ~15 days

Recently: every ~26 days

Total

8

Last Release

3298d ago

Major Versions

1.2 → 2.02017-01-15

2.1.1 → 3.02017-05-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c778dda35b2abb440837a7dd053a3e53994202a61c51b04e570c69be3d8baeb?d=identicon)[ymslavov](/maintainers/ymslavov)

---

Top Contributors

[![ymslavov](https://avatars.githubusercontent.com/u/6988950?v=4)](https://github.com/ymslavov "ymslavov (10 commits)")[![yasenslavov](https://avatars.githubusercontent.com/u/19605805?v=4)](https://github.com/yasenslavov "yasenslavov (1 commits)")

### Embed Badge

![Health badge](/badges/ymslavov-laravel-repository/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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