2017 © Pedro Peláez
 

library laravel-mrs-generators

This package is a experimental project inspired by yish/generators which extends the core file generators based on Laravel 5. It can help you build classes with basic Model-Repository-Service pattern.

image

chihchenghuang/laravel-mrs-generators

This package is a experimental project inspired by yish/generators which extends the core file generators based on Laravel 5. It can help you build classes with basic Model-Repository-Service pattern.

  • Thursday, September 7, 2017
  • by chihchenghuang
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel MRS Generators

This package is a experimental project inspired by yish/generators which extends the core file generators based on Laravel 5 It can help you build classes with basic Model-Repository-Service pattern., (*1)

Installation

Install by composer, (*2)

    $ composer require chihchenghuang/laravel-mrs-generators

Registing Service Provider, (*3)

``` php <?php, (*4)

//app.php, (*5)

'providers' => [, (*6)

    /*
     * Laravel MRS Generators Service Provider
     */
    \ChihCheng\MRSGenerators\GeneratorsServiceProvider::class,

],
or

``` php
<?php

//app/Providers/AppServiceProvider.php

    public function register()
    {
        if ($this->app->environment() == 'local')
        {
            /*
             * Laravel MRS Generators Service Provider
             */
            $this->app->register( \ChihCheng\MRSGenerators\GeneratorsServiceProvider::class );

        }
    }

Example

Generate Repository:

This command will generate a repository class., (*7)

    $ php artisan make:repository Repositories/TestRepository

Generate Service:

This command will generate a service class., (*8)

    $ php artisan make:repository Services/TestService

Generate classes based on the corresponding Model-Repository-Service Pattern Set:

This command will generate classes based on the corresponding Model-Repository-Service Pattern Set. It will create files like the example pattern below by using only one command:, (*9)

    $ php artisan make:mrs-model Test
  • app/Models/Test.php ``` php <?php

namespace App\Models;, (*10)

use Illuminate\Database\Eloquent\Model;, (*11)

class Test extends Model { // }, (*12)

* app/Repositories/TestRepository.php
``` php
<?php

namespace App\Repositories;

use App\Models\Test;

class TestRepository
{
    protected $test;

    public function __construct( Test $test )
    {
        $this->test = $test;
    }

}

  • app/Services/TestService.php ``` php <?php

namespace App\Services;, (*13)

use App\Repositories\TestRepository;, (*14)

class TestService { protected $testRepository;, (*15)

public function __construct( TestRepository $testRepository )
{
    $this->testRepository = $testRepository;
}

}, (*16)

```, (*17)

The Versions

07/09 2017

dev-master

9999999-dev

This package is a experimental project inspired by yish/generators which extends the core file generators based on Laravel 5. It can help you build classes with basic Model-Repository-Service pattern.

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by ChihCheng Huang

29/08 2017

0.1.2

0.1.2.0

This package is a experimental project inspired by yish/generators which extends the core file generators based on Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by ChihCheng Huang