Download the PHP package garethnic/repo without Composer
On this page you can find all versions of the php package garethnic/repo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download garethnic/repo
More information about garethnic/repo
Files in garethnic/repo
Package repo
Short Description Scaffold repository pattern in Laravel
License MIT
Homepage https://github.com/io-digital/repo
Informations about the package repo
Repo
This package creates scaffolding to implement the Repository pattern.
Install
composer require io-digital/repo
Add the ServiceProvider to your config/app.php providers array:
Then run the following artisan command:
This will create the following folder structure in your app/
folder:
- Models
- Concrete
- Eloquent
- AbstractEloquentRepository.php
- Contracts
- Repositories
- RepositoryInterface.php
- Objects
- Concrete
Usage
After installing the package the artisan command repo:create
should be available.
To create the repository structure for your object run the command:
This will create the following files:
- Models/Objects/Post.php
- Models/Contracts/Repositories/PostRepository.php
- Models/Concrete/Eloquent/EloquentPostRepository.php
It will also add the bindings in your AppServiceProvider.php
file:
Then in your Controller it's simply:
Options
-m
or--m
Use the the -m
option to create a migration file for your object:
The repository interface provides the following methods:
The implementations can found in Models/Concrete/AbstractEloquentRepository.php
Example usage for the find functions:
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONDUCT for details.
TODO
Clean up code
License
The MIT License (MIT). Please see License File for more information.