New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

ymslavov/laravel-repository

Stateful repositories for Laravel models.
1,408

Larablocks Analysis

ymslavov/laravel-repository works with Laravel 5 (latest release 3.0, May 1, 2017), which reached end of life: no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5, past end of life
  • No release in the last 12 months (last: May 1, 2017)
  • 0 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: May 1, 2017.
  • No releases in the last 12 months.
  • First released: Jan 12, 2017.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 28, 2026.

Install
composer require ymslavov/laravel-repository
Latest Version:3.0
PHP:>=5.6.4
Laravel:5
License:MIT
Last Updated:May 1, 2017
Links: GitHub  ·  Packagist
Maintainer: ymslavov

Stateful Repository Implementation

Based on the work featured in bosnadev.com, but with a few additional helpful methods for multi-record operations.

Laravel 5.3+ required.

Installation via Composer

composer require ymslavov/laravel-repository

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

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();

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released PHP Laravel License
3.0 >=5.6.4 5.3.* MIT
2.1.1 >=5.6.4 5.3.* MIT
2.1 >=5.6.4 5.3.* MIT
2.0.1 >=5.6.4 5.3.* MIT
2.0 >=5.6.4 5.3.*