Download the PHP package san4io/repository without Composer
On this page you can find all versions of the php package san4io/repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download san4io/repository
More information about san4io/repository
Files in san4io/repository
Package repository
Short Description Reusable Laravel repository interface.
License MIT
Informations about the package repository
Caffeinated Repository
Getting Started
Introduction
The Caffeinated Repository package allows the means to implement 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.
Installing Caffeinated Repository
It is recommended that you install the package using Composer.
This package is compliant with PSR-1, PSR-2, and PSR-4. If you find any compliance oversights, please send a patch via pull request.
Using Repositories
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.
Create a Repository
Create a new Repository class - usually these classes are simply stored within a Repositories
directory. There are a few requirements for each repository instance:
- Repository classes must extend the Caffeinated EloquentRepository class.
- Repository classes must specify a public property pointing to the model.
- Repository classes must specify an array of cache tags. These tags are used by the package to handle automatic cache busting when relevent values change within the database.
Injecting a Repository
Once you've built and configured your repository instance, you may inject the class within your classes where needed: