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

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

larachimp/mango-repo
====================

Simple repository package for Laravel 5.

v3.0.0(4y ago)307.2k8MITPHPPHP ^7.3|^8.0

Since Apr 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/LaraChimp/mango-repo)[ Packagist](https://packagist.org/packages/larachimp/mango-repo)[ RSS](/packages/larachimp-mango-repo/feed)WikiDiscussions develop Synced 4w ago

READMEChangelog (10)Dependencies (5)Versions (20)Used By (0)

 [![](https://raw.githubusercontent.com/LaraChimp/art-work/master/packages/mango-repo/mango-repo-art.png)](https://raw.githubusercontent.com/LaraChimp/art-work/master/packages/mango-repo/mango-repo-art.png) Mango Repo
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#----mango-repo)

 [![Latest Stable Version](https://camo.githubusercontent.com/fc53c89c50a972b9f353fbdf1a3996c602382373944f776be4e79c8692eb6e15/68747470733a2f2f706f7365722e707567782e6f72672f6c6172616368696d702f6d616e676f2d7265706f2f762f737461626c65)](https://packagist.org/packages/larachimp/mango-repo) [![Latest Unstable Version](https://camo.githubusercontent.com/a63b7dca50a2f89bee7fbf550f0a18564eaa95acd2c2ebf43026a30e08fbbf73/68747470733a2f2f706f7365722e707567782e6f72672f6c6172616368696d702f6d616e676f2d7265706f2f762f756e737461626c65)](https://packagist.org/packages/larachimp/mango-repo) [![Build Status](https://camo.githubusercontent.com/3e08063cc73218cc8ef75a9e58afce3a9cf2ef3fd04a4d072d2fbb6752c26881/68747470733a2f2f7472617669732d63692e6f72672f4c6172614368696d702f6d616e676f2d7265706f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/LaraChimp/mango-repo) [![StyleCI](https://camo.githubusercontent.com/663655008692f313b863199c7e629fe6436ceb0f5cd66a3316c0d155b20df9fd/68747470733a2f2f7374796c6563692e696f2f7265706f732f38343437303236322f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/84470262) [![License](https://camo.githubusercontent.com/8adbd1654feb53a7987b28023ed8992616fc22a9ed2a2f3f962c7ba5dea7ee8b/68747470733a2f2f706f7365722e707567782e6f72672f6c6172616368696d702f6d616e676f2d7265706f2f6c6963656e7365)](https://packagist.org/packages/larachimp/mango-repo) [![Total Downloads](https://camo.githubusercontent.com/203e0c56b4539aa8c05c1c641c20b48d59f69e3011a9ded8530b788e4488c560/68747470733a2f2f706f7365722e707567782e6f72672f6c6172616368696d702f6d616e676f2d7265706f2f646f776e6c6f616473)](https://packagist.org/packages/larachimp/mango-repo) [![](https://camo.githubusercontent.com/d622d6d70fd449a3cfeddfb797c45b628c7978a374de10c41dbb235e667a2ec5/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f66323138393163652d346234382d343530372d616134622d6132353437343537313437332f6d696e692e706e67)](https://insight.sensiolabs.com/projects/f21891ce-4b48-4507-aa4b-a25474571473)

Introduction
------------

[](#introduction)

Mango Repo is an Eloquent Repository package that aims at bringing an easy to use and fluent API. Getting started with repository pattern can be quite overwhelming. This is especially true for newcomers to Eloquent who are getting the grasp of active record. Behind the scenes Mango Repo tries to use as much of the Eloquent API as possible and keeping things simple.

License
-------

[](#license)

Mango Repo is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

Version Compatibility
---------------------

[](#version-compatibility)

LaravelMangoRepo5.0.x0.2.x5.1.x0.2.x5.2.x0.2.x5.3.x0.2.x5.4.x0.2.x5.5.x0.2.x5.6.x0.3.x5.7.x0.3.x5.8.x0.4.x6.x1.x7.x2.x8.x3.x### Installation

[](#installation)

Install Mango Repo as you would with any other dependency managed by Composer:

```
$ composer require larachimp/mango-repo
```

### Configuration

[](#configuration)

> If you are using Laravel &gt;= 5.5, you can skip service registration thanks to Laravel auto package discovery feature.

After installing Mango repo all you need is to register the `LaraChimp\MangoRepo\MangoRepoServiceProvider` and `LaraChimp\PineAnnotations\PineAnnotationsServiceProvider`in your `config/app.php` configuration file:

```
'providers' => [
    // Other service providers...

    LaraChimp\PineAnnotations\PineAnnotationsServiceProvider::class,
    LaraChimp\MangoRepo\MangoRepoServiceProvider::class,
],
```

Optionally you can register the annotations reader alias.

```
'aliases' => [
    ...
    'AnnotationsReader' => LaraChimp\PineAnnotations\Facades\Reader::class,
],
```

For more information check out the [PineAnnotations package](https://github.com/LaraChimp/pine-annotations) for more information on the annotation reader.

### Creating a repository class

[](#creating-a-repository-class)

Use the `mango:make` command to create your repository classes. This command will take as argument the repository class namesapce (from App) and a `--model` option which allows you to specify the full namespace of the Eloquent model to which the repository will be tied.

```
$ php artisan mango:make "Repositories\Posts" --model="App\Models\Post"
```

The above command will generate the following repository class in the `app/Repositories` directory:

```
