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

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

mnshankar/repository
====================

Reusable repository interface - Forked from Caffeinated/repository, modified to work with Laravel 5.0/php 5.4

v3.1(8y ago)113MITPHPPHP &gt;=5.4.0

Since Dec 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mnshankar/repository)[ Packagist](https://packagist.org/packages/mnshankar/repository)[ RSS](/packages/mnshankar-repository/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (18)Used By (0)

Caffeinated Repository
======================

[](#caffeinated-repository)

**This is a fork of the Caffeinated Repository package for LARAVEL 5.0 (using PHP 5.4)**

Getting Started
---------------

[](#getting-started)

### Introduction

[](#introduction)

The Caffeinated Repository package implements a standard boilerplate repository interface. This covers the standard Eloquent methods in a non-static, non-facade driven way right out of the box. Fear not though Batman! The Caffeinated Repository package does not limit you in any way when it comes to customizing (e.g overriding) the provided interface or adding your own methods.

If you want database result caching to work, please note that you need a caching solution that supports "tags" (ex. Redis/Memcached). This package automatically caches data retrieved through the repository (for 60 mins). It also handles cache busting (based on tags) for data that is updated via the repository. In fact, it is for this feature that Caffeinated/repository requires the use of a caching store with Tags feature - It makes removing chunks of data from the cache easy.

Installing Caffeinated Repository
---------------------------------

[](#installing-caffeinated-repository)

It is recommended that you install the package using Composer.

```
composer require mnshankar/repository

```

IMPORTANT: Also add the service provider to your app/config.php file - This sets up eventing so updates through your repository invalidate the cache, thus forcing a requery.

```
'Caffeinated\Repository\RepositoryServiceProvider'

```

This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you find any compliance oversights, please send a patch via pull request.

Using Repositories
==================

[](#using-repositories)

### Create a Model

[](#create-a-model)

Create your model like you normally would. We'll be wrapping our repository around our model to access and query the database for the information we need.

```
