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

AbandonedLibrary[Framework](/categories/framework)

deseco/repository
=================

Easy repositories for laravel.

v2.0.2(8y ago)01.7kMITPHPPHP &gt;=5.5.9

Since Feb 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/DesecoHesto/repository)[ Packagist](https://packagist.org/packages/deseco/repository)[ RSS](/packages/deseco-repository/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (12)Used By (0)

Simple repositories for Laravel
===============================

[](#simple-repositories-for-laravel)

#### Package is currently under development !!

[](#package-is-currently-under-development-)

### Info

[](#info)

Simple package which allows to implement repository pattern in Laravel applications. Inspired by [Bosnadev](https://github.com/bosnadev/repository) package. Supports criteria, query filters, and can interact with fractal.

### Installation

[](#installation)

```
composer require deseco/repository
```

Add service provider into config/app.php

```
$providers = [
    ....

    Deseco\Repositories\RepositoriesServiceProvider::class,
];
```

Publish configuration

```
php artisan vendor:publish  --provider="Deseco\Repositories\RepositoriesServiceProvider"
```

Setup configuration for repositories like:

- namespace - repositories namespace
- suffix - for repositories classes e.g.: `Repository`
- path - path to repositories
- class - factory repository class, when injected allows to easily create repositories (has auto-completion for Phpstorm)

### Usage

[](#usage)

You can create repository with command:

```
php artisan repository:make
```

You will be asked to specify repository name

```
Enter repository name::
> Clients
```

and alias (optional):

```
Enter alias name [clients]:
>
```

You will get two files:

```
Generating repository...

+-------------------+-------------------+----------+---------+
| Class             | Repository        | Property | Status  |
+-------------------+-------------------+----------+---------+
| ClientsRepository | -                 | -        | Created |
| Repositories      | ClientsRepository | clients  | Created |
+-------------------+-------------------+----------+---------+

Done!
```

Repository class (implement model method):

```
