2017 © Pedro Peláez
 

library generators

Extend Laravel 5's generators.

image

mulford/generators

Extend Laravel 5's generators.

  • Friday, April 10, 2015
  • by kenmulford
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Laravel 5/Fractal Transformer Generator

This extends the php artisan command list to include a command for generating a basic Fractal transformer based on your existing Eloquent model., (*1)

Usage

Step 1: Install Via Composer

composer require 'mulford/generators' --dev

Step 2: Register the Service Provider

Open config/app.php and add the line to the bottom of your providers array:, (*2)

"Mulford\Generators\TransformerGeneratorServiceProvider"

Step 3: Run Artisan

Run php artisan list from the console and you will see make:transformer in the "make" section., (*3)

Defaults

By default, this library references models in the App\Models namespace (not the Laravel 5 default of App). It creates new Transformer classes in App\Transformers. In a future version I will try to make this a config option., (*4)

Example

php artisan make:transformer --model=User, (*5)

This command will create a basic Fractal Transformer class with some placeholders, as well as a basic transform() method. By default the transform() object array is populated based on the Eloquent model's $fillable property. Obviously you can tweak the list as desired, but it serves as a decent starting point., (*6)

Future

Eventually I hope to work out a way to create includes based on Eloquent relationships. If you are interested in helping feel free to send a pull request!, (*7)

The Versions

10/04 2015

dev-master

9999999-dev

Extend Laravel 5's generators.

  Sources   Download

MIT

The Requires

 

by Ken Mulford

laravel generators fractal

10/04 2015

0.2.0

0.2.0.0

Extend Laravel 5's generators.

  Sources   Download

MIT

The Requires

 

by Ken Mulford

laravel generators fractal

10/04 2015

dev-dev

dev-dev

Extend Laravel 5's generators.

  Sources   Download

MIT

The Requires

 

by Ken Mulford

laravel generators fractal

07/04 2015

0.1.2

0.1.2.0

Extend Laravel 5's generators.

  Sources   Download

MIT

The Requires

 

by Ken Mulford

laravel generators fractal

07/04 2015

0.1.1

0.1.1.0

Extend Laravel 5's generators.

  Sources   Download

MIT

The Requires

 

by Ken Mulford

laravel generators fractal

07/04 2015

v0.1.0

0.1.0.0

Extend Laravel 5's generators.

  Sources   Download

MIT

The Requires

 

by Ken Mulford

laravel generators fractal