Laravel 5和方式/发电机

I try to include way/generators to laravel 5.0

I follow these steps:

  1. I include it into require dev: require way/generators --dev
"require-dev": {
    "phpunit/phpunit": "~4.0",
    "phpspec/phpspec": "~2.1,
    "way/generators" : "~3.0"
},
  1. I do composer update, also I try with composer update --dev

  2. I add a new item to the providers array.

'Way\Generators\GeneratorsServiceProvider'
  1. now when I type: php artisan in console I got error

    exception 'BadMethodCallException' with message 'Call to undefined method [package]' in C:\xampp\htdocs\testni\storage\framework\compiled.php:4351 Stack trace:

Directly from the GitHub readme.md for JeffreyWay/Laravel-4-Generators:

There is no support for Laravel 5, as the framework now includes a number of generators out of the box.

Generators included in laravel 5 are very useful now so maybe you shouldn't worry about that, just type in php artisan to see the full list of them, they are under the make section

For Laravel 5 Jeffrey Way already created Laravel 5 Extended Generators.

https://github.com/laracasts/Laravel-5-Generators-Extended

You can even see it in action in Laracasts website.

https://laracasts.com/lessons/faster-workflow-with-generators

It is still using php artisan command but so far there are 3 additional methods like

  • mmake:migration:schema
  • make:migration:pivot
  • make:seed

To install - composer require laracasts/generators --dev

composer require laracasts/generators --dev


Add this to config/app.php


'Laracasts\Generators\GeneratorsServiceProvider',