PHPackages                             io-digital/repo - 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. io-digital/repo

AbandonedArchivedLibrary[Framework](/categories/framework)

io-digital/repo
===============

Easily generate the Repository Pattern in Laravel

v1.1.21(8y ago)32.2k1MITPHPPHP ~5.6|~7.0

Since Mar 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/io-digital/repo)[ Packagist](https://packagist.org/packages/io-digital/repo)[ Docs](https://github.com/io-digital/repo)[ RSS](/packages/io-digital-repo/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (4)Versions (30)Used By (0)

Repo
====

[](#repo)

This package creates scaffolding to implement the Repository pattern.

Install
-------

[](#install)

*Repo supports package auto discovery for Laravel*

`composer require io-digital/repo`

Add the ServiceProvider to your config/app.php providers array:

```
IoDigital\Repo\RepoServiceProvider::class,
```

Then run the following artisan command:

```
$ php artisan vendor:publish --provider="IoDigital\Repo\RepoServiceProvider"
```

This will create the following folder structure in your `app/` folder:

- Models
    - Concrete
        - Eloquent
        - \_AbstractEloquentRepository.php
    - Contracts
        - Repositories
        - \_RepositoryInterface.php
    - Objects

Note that \_AbstractEloquentRepository.php and \_RepositoryInterface.php are named as such to avoid existing files being overwritten. In the case of a new installation, these files can simply be renamed to AbstractEloquentRepository.php and RepositoryInterface.php, respectively. If these files already exist, on the other hand, please take care to manually merge the newly published files with the existing ones.

Usage
-----

[](#usage)

After installing the package the artisan command `repo:create` should be available.

To create the repository structure for your object run the command:

```
$ php artisan repo:create Post
```

This will create the following files:

- Models/Objects/Post.php
- Models/Contracts/Repositories/PostRepository.php
- Models/Concrete/Eloquent/EloquentPostRepository.php

It will also add the bindings in your `AppServiceProvider.php` file:

```
$this->app->bind(
    'App\Models\Contracts\Repositories\PostRepository', // Repository (Interface)
    'App\Models\Concrete\Eloquent\EloquentPostRepository' // Eloquent (Class)
);
```

Then in your Controller it's simply:

```
...
use App\Models\Contracts\Repositories\PostRepository;

...

protected $model;

public function __construct(PostRepository $repo)
{
    $this->model = $repo;
}
```

### Options

[](#options)

- `-m` or `--m`
- `-c` or `--c`

Use the `-m` option to create a migration file for your object:

```
$ php artisan repo:create Post -m
```

Use the `-c` option to create a resource controller for your object:

```
$ php artisan repo:create Post -c
```

All together now:

```
$ php artisan repo:create Post -m -c
```

The repository interface provides the following methods:

```
public function make($with = [], $orderBy = []);

public function all($with = [], $orderBy = [], $columns = ['*']);

public function find($id, $relations = []);

public function findBy($attribute, $value, $columns = ['*']);

public function findAllBy($attribute, $value, $columns = ['*']);

public function findWhere($where, $columns = ['*'], $or = false);

public function findWhereIn($field, array $values, $columns = ['*']);

public function paginate($perPage = 25, $columns = ['*']);

public function simplePaginate($limit = null, $columns = ['*']);

public function create($attributes = []);

public function edit($id, $attributes = []);

public function delete($id);
```

The implementations can found in `Models/Concrete/AbstractEloquentRepository.php`

Example usage for the find functions:

```
//returns the model with the relationship as a paginated collection
$data = $this->model->make(['relation'])->paginate();

//returns with ->first()
$data = $this->model->findBy('title', $title);

//returns with ->get()
$data = $this->model->findAllBy('category', $category);

//returns with ->get()
$data = $this->model->findWhere([
            'category' => $category,
           ['year', '>' , $year],
           ['name', 'like', "%$name%"],
           ['surname', 'like', '%nes']
     ]);

 $data = $this->model->findWhereIn('id', [1, 2, 3])
                     ->get(['name', 'email']);
```

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

[](#change-log)

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

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

TODO
----

[](#todo)

Clean up code

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 97.7% 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 ~21 days

Recently: every ~73 days

Total

23

Last Release

3241d ago

Major Versions

v0.1.18 → v1.1.182016-09-06

PHP version history (2 changes)v0.1.0PHP ~5.5|~7.0

v1.1.20PHP ~5.6|~7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0acb24b4d76853e47a3ad42fba61d9c623a7e0ea4d38e52ac134dd953174529b?d=identicon)[io-digital](/maintainers/io-digital)

---

Top Contributors

[![garethnic](https://avatars.githubusercontent.com/u/1523598?v=4)](https://github.com/garethnic "garethnic (43 commits)")[![rianzietsman](https://avatars.githubusercontent.com/u/140623410?v=4)](https://github.com/rianzietsman "rianzietsman (1 commits)")

---

Tags

laravelrepositorypatternrepo

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/io-digital-repo/health.svg)

```
[![Health](https://phpackages.com/badges/io-digital-repo/health.svg)](https://phpackages.com/packages/io-digital-repo)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[laravel/jetstream

Tailwind scaffolding for the Laravel framework.

4.1k19.8M136](/packages/laravel-jetstream)[internachi/modular

Modularize your Laravel apps

1.1k662.4k8](/packages/internachi-modular)

PHPackages © 2026

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