What is a repository?

Build Status Latest Stable Version Total Downloads Patreon donate button Donate weekly to this project using Gratipay Donate to this project using Flattr Donate to this project using Paypal

A repository is a class that lies somewhere between the controller and the database logic to make your application's service layers (including controllers) more lightweight and allows you to more easily re-use database logic in your application.

A pure repository implementation means that it is the gateway from your application logic to the database - only the repository knows how to read/write from/to the database, the rest of your application has to go through a repository to achieve persistence.