PHPackages                             vespakoen/epi - 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. [API Development](/categories/api)
4. /
5. vespakoen/epi

ActiveLibrary[API Development](/categories/api)

vespakoen/epi
=============

2.0.7(12y ago)13298[1 issues](https://github.com/vespakoen/epi/issues)PHPPHP &gt;=5.3.0

Since Dec 13Pushed 12y ago3 watchersCompare

[ Source](https://github.com/vespakoen/epi)[ Packagist](https://packagist.org/packages/vespakoen/epi)[ RSS](/packages/vespakoen-epi/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (10)Used By (0)

Epi
===

[](#epi)

[![Build Status](https://camo.githubusercontent.com/d92a71507e82699f7593c63ad1cde2417452de9d4144bd83461d95708ae7bb65/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f76657370616b6f656e2f6570692e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/vespakoen/epi)

Creating an API can be a tedious task, and if you need to filter your data in specific ways, things are bound to get nasty. Epi comes with a controller that handles your basic CRUD tasks for an Eloquent model, but the index / "read all" method it where Epi really shines.

Imagine that you have a `Page` model that has got a relationship with a `PageTranslation` model. Perhaps you would want to retrieve a page by it's slug that lives in the PageTranslation model. With Epi, it would be a simple as requesting the following URL: `api/pages?filter[translation.slug]=some-slug`.

Installation
------------

[](#installation)

To add Epi to your Laravel application, follow these steps:

Add the following to your `composer.json` file:

```
"vespakoen/epi" : "dev-master"
```

Then, run `composer update` or `composer install` if you have not already installed packages.

Add the line below to the `providers` array (at the end) in the `app/config/app.php` configuration file:

```
'Vespakoen\Epi\EpiServiceProvider',
```

Optionally, if you don't want to add "use" statements to your controller, add the line below to the `aliases` array (at the end) in the `app/config/app.php` configuration file:

```
'EpiController' => 'Vespakoen\Epi\Controllers\EpiController',
```

Configuration
-------------

[](#configuration)

You will want to run the following command to publish the config to your application, otherwise it will be overwritten when the package is updated.

```
php artisan config:publish vespakoen/epi
```

Usage
-----

[](#usage)

To build an Api using Epi we will need to create a controller that extends from the EpiController and is then registered with the router. First we need to create a controller, preferrably, this controller is seperated from the rest of your controllers by putting the controllers for the Api in a new folder. This folder could be `app/controllers/api` (make sure you add this path to the autoloader in `app/start/global.php` !) or `/src/Somevendor/SomePackage/Controllers/Api` depending on your situation.

Here is an example:

```
