Download the PHP package taylornetwork/laravel-repository without Composer
On this page you can find all versions of the php package taylornetwork/laravel-repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download taylornetwork/laravel-repository
More information about taylornetwork/laravel-repository
Files in taylornetwork/laravel-repository
Package laravel-repository
Short Description A repository service provider to dynamically bind all existing repositories in app.
License
Informations about the package laravel-repository
Repositories for Laravel
An easy and customizable to create repositories that will be automatically registered for you.
Install
Via Composer
Setup
Add the service provider to the providers array in config/app.php
Publish Config
Will add repository.php
to your config directory.
Usage
The service provider will automatically bind repositories to their contracts based on the settings in config/repository.php
Defaults
By default Repositories are stored in App\Repositories\ModelName
where ModelName
is the name of the model the repository will handle.
The default naming convention used is ModelNameRepository
for the contract and EloquentModelName
for the class.
Commands
make:repository
This package adds the artisan command repository:generate
to create the repository pattern based on settings in config/repository.php
To create a repository for the User
model
Will create
If you are using a driver other than Eloquent
you can specify using the --driver
option
Will create
Note: If you plan on using other drivers add them to the drivers
array in config/repository.php
, the service provider will search for the class in the order of the array.
make:repositoryClass
Same as repository:generate
but will only create the class, no contract.
Creates app/Repositories/User/StorageUser.php
make:repositoryContract
Same as repository:generate
but will only create the contract, no class.
Creates app/Repositories/User/UserRepository.php
Note: This command does not accept the --driver
option.
Credits
- Author: Sam Taylor
License
The MIT License (MIT). Please see License File for more information.