2017 © Pedro Peláez
 

helper generators

A highly opinionated file generator for Laravel 5.3+

image

captbrogers/generators

A highly opinionated file generator for Laravel 5.3+

  • Sunday, November 19, 2017
  • by captbrogers
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1,522 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

generators

A highly opinionated file/class generator for Laravel 5.1+, (*1)

This provides an alternative to the default model generator and adds an option to generate a repository pattern class for a model., (*2)

Examples

Installation

  1. Install via Composer
composer require captbrogers/generators --dev
  1. Load via Service Provider

It is recommended to load this package only in local/development environments. To do so, update your app/Providers/AppServiceProvider.php file (register method) with the following snippet:, (*3)

if ($this->app->environment() === 'local') {
    $this->app->register('Captbrogers\Generators\GeneratorServiceProvider');
}

Models

This will create an Eloquent model but with more property overrides by default, optionally including a repository pattern file., (*4)

To generate a new model in the app/Models directory, use the following command replacing {{ name }} with the desired Model class name:, (*5)

php artisan gen:model {{ name }}

You may also create a repository file (seen below) with the following command:, (*6)

php artisan gen:model {{ name }} --with-repository=true

Repositories

Repositories attempt to adhere to the "Repository Pattern", you can see more on it here. It assumes they are relating to Eloquent usage, and as such will create an app/Repositories/Eloquent and app/Repositories/Contracts directories. It will name the generated files respectively as such:, (*7)

{{ name }}Repository.php, (*8)

{{ name }}RepositoryContract.php, (*9)

It will also implement the contract (interface) so that if you decide to change from Eloquent at a later date it can assure that a minimum functionality will be required., (*10)

To generate a new Eloquent repository file with contract, use the following command replacing {{ name }} with a corresponding Model class name:, (*11)

php artisan gen:repository {{ name }}
Traits for Repository

Included in this package is a trait that will have a good amount of methods that you can hook into to keep in line with the Repository Pattern. You can get it installed using the following the command:, (*12)

php artisan gen:trait {{ name }}

TODO

  • Finish writing tests

The Versions

19/11 2017

dev-develop

dev-develop https://git.ditoforge.com/brian/generators

A highly opinionated file generator for Laravel 5.3+

  Sources   Download

GPLv3

The Requires

 

The Development Requires

laravel scaffolding

08/08 2017

dev-master

9999999-dev https://git.ditoforge.com/brian/generators

A highly opinionated file generator for Laravel 5.3+

  Sources   Download

GPLv3

The Requires

 

The Development Requires

laravel scaffolding

06/07 2017

1.2.0

1.2.0.0 https://git.ditoforge.com/brian/generators

A highly opinionated file generator for Laravel 5.3+

  Sources   Download

GPLv3

The Requires

 

The Development Requires

laravel scaffolding

01/07 2016

0.2.1

0.2.1.0

A highly opinionated file generator for Laravel 5.1+

  Sources

GPLv3

The Requires

 

26/03 2016

0.1.2

0.1.2.0 https://bitbucket.org/captbrogers/generators

A highly opinionated file generator for Laravel 5.1+

  Sources   Download

GPLv3

The Requires

 

26/03 2016

0.1

0.1.0.0 https://bitbucket.org/captbrogers/generators

A highly opinionated file generator for Laravel 5.1+

  Sources   Download

GPLv3

The Requires