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

ActiveLibrary[Framework](/categories/framework)

garethnic/repo
==============

Scaffold repository pattern in Laravel

v0.1.10(9y ago)022MITPHPPHP ~5.5|~7.0

Since Mar 11Pushed 9y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (4)Versions (14)Used By (0)

Repo
====

[](#repo)

This package creates scaffolding to implement the Repository pattern.

Install
-------

[](#install)

`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

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`

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

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

The repository interface provides the following methods:

```
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 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

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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 ~13 days

Total

11

Last Release

3633d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laravelrepositorypatternrepo

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k91.3M282](/packages/laravel-horizon)[laravel/sail

Docker files for running a basic Laravel application.

1.9k199.2M1.2k](/packages/laravel-sail)[laravel/ai

The official AI SDK for Laravel.

1.0k2.1M163](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77018.2M122](/packages/laravel-mcp)[laravel/surveyor

Static analysis tool for Laravel applications.

8690.3k12](/packages/laravel-surveyor)

PHPackages © 2026

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