2017 © Pedro Peláez
 

library laravel-repository

A repository service provider to dynamically bind all existing repositories in app.

image

taylornetwork/laravel-repository

A repository service provider to dynamically bind all existing repositories in app.

  • Wednesday, September 20, 2017
  • by taylornetwork
  • Repository
  • 1 Watchers
  • 1 Stars
  • 46 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Repositories for Laravel

An easy and customizable to create repositories that will be automatically registered for you., (*1)

Install

Via Composer, (*2)

``` bash $ composer require taylornetwork/laravel-repository, (*3)


## Setup Add the service provider to the providers array in `config/app.php` ``` php 'providers' => [ TaylorNetwork\LaravelRepository\RepositoryServiceProvider::class, ],

Publish Config

``` bash $ php artisan vendor:publish, (*4)


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 ``` bash $ php artisan repository:generate User

Will create, (*5)

- ProjectRoot
    - app
        - Repositories
            - User
                - UserRepository.php
                - EloquentUser.php

If you are using a driver other than Eloquent you can specify using the --driver option, (*6)

``` bash $ php artisan repository:generate User --driver=storage, (*7)

Will create

  • ProjectRoot
    • app
      • Repositories
        • User
          • UserRepository.php
          • StorageUser.php

*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. ``` bash $ php artisan repository:class User --driver=storage

Creates app/Repositories/User/StorageUser.php, (*8)

make:repositoryContract

Same as repository:generate but will only create the contract, no class., (*9)

bash $ php artisan repository:contract User, (*10)

Creates app/Repositories/User/UserRepository.php, (*11)

Note: This command does not accept the --driver option., (*12)

Credits

License

The MIT License (MIT). Please see License File for more information., (*13)

The Versions

20/09 2017

dev-master

9999999-dev

A repository service provider to dynamically bind all existing repositories in app.

  Sources   Download

The Requires

 

The Development Requires

by Sam Taylor

09/09 2017

1.3.0

1.3.0.0

A repository service provider to dynamically bind all existing repositories in app.

  Sources   Download

The Requires

 

by Sam Taylor

15/08 2017

1.2.0

1.2.0.0

A repository service provider to dynamically bind all existing repositories in app.

  Sources   Download

The Requires

 

by Sam Taylor

20/02 2017

1.1.0

1.1.0.0

A repository service provider to dynamically bind all existing repositories in app.

  Sources   Download

The Requires

 

by Sam Taylor

22/11 2016

1.0.0

1.0.0.0

A repository service provider to dynamically bind all existing repositories in app.

  Sources   Download

The Requires

 

by Sam Taylor