3ev / repoman
This package is abandoned and no longer maintained.
No replacement package was suggested.
Lightweight repository pattern implementation
v1.0.0
2015-05-14 15:49 UTC
Requires
- php: >= 5.4
Requires (Dev)
- illuminate/database: ~5.0
Suggests
- illuminate/database: Required for the Eloquent implementation
This package is not auto-updated.
Last update: 2024-02-17 14:06:28 UTC
README
#Repoman
Lightweight repository pattern interfaces and implementations.
See this article for a description of the repository pattern in Laravel.
##Installation
$ composer require "3ev/repoman:~1.0"
##Usage
Repoman provides a basic interface for a repository. You can implement it yourself, or leverage one of the supplied implementations. You can extend the interface for your own specific repository classes.
See the phpdoc in the source files for information on the API and errors.
###Basic implementation
<?php namespace Entity\Repositories; use Tev\Repoman\Repositories\RepositoryInterface; class Repository implements RepositoryInterface { public function getAll() { // ... } public function chunk($size, $callback) { // ... } public function find($id) { // ... } public function create(array $data) { // ... } public function update($id, array $data) { // ... } public function delete($id) { // ... } }
###Eloquent
<?php namespace Entity\Repositories\Eloquent; use Entity\Models\ExampleModel; use Tev\Repoman\Repositories\Eloquent\Repository; class ExampleModelRepository extends Repository { public function __construct() { $this->model = new ExampleModel; } }
##License
MIT