PHPackages                             flickerleap/lumen-generators - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. flickerleap/lumen-generators

ActiveLibrary[HTTP &amp; Networking](/categories/http)

flickerleap/lumen-generators
============================

A collection of generators for Lumen and Laravel 5.

1.4.0(8y ago)013MITPHPPHP &gt;=5.5.0

Since Oct 2Pushed 8y ago2 watchersCompare

[ Source](https://github.com/flickerleap/lumen-generators)[ Packagist](https://packagist.org/packages/flickerleap/lumen-generators)[ RSS](/packages/flickerleap-lumen-generators/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (11)Used By (0)

Lumen generators
================

[](#lumen-generators)

[![Build Status](https://camo.githubusercontent.com/104a08f4e55a5d7b81bb85e36d59f3ef748f2dfd9a89346427f3fdfed2ad8675/68747470733a2f2f7472617669732d63692e6f72672f7765624e6561742f6c756d656e2d67656e657261746f72732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/webNeat/lumen-generators)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ede2a3931a2c267a867018272b26f500ad833f830a04dec73e13db9e7d63cfb1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7765624e6561742f6c756d656e2d67656e657261746f72732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/webNeat/lumen-generators/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/b9ed2a8132c05284574c81a31b577e2c5c09f97a66b756c1ffd179da27c497ae/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f38333836323463332d323038642d346261352d383461612d3361666337366230393362622f6d696e692e706e67)](https://insight.sensiolabs.com/projects/838624c3-208d-4ba5-84aa-3afc76b093bb)[![License](https://camo.githubusercontent.com/f45d904953153ca304a2328243d2733e095eee13a631a1f390709885d41dd692/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2f6672616d65776f726b2f6c6963656e73652e737667)](https://github.com/webNeat/lumen-generators/blob/master/LICENSE)

A collection of generators for [Lumen](http://lumen.laravel.com) and [Laravel 5](http://laravel.com/).

Contents
--------

[](#contents)

- [Why ?](#why)
- [Installation](#installation)
- [Quick Usage](#quick-usage)
- [Detailed Usage](#detailed-usage)

    - [Model Generator](#model-generator)
    - [Migration Generator](#migration-generator)
    - [Pivot Table Generator](#pivot-table-generator) (Since version 1.1.0)
    - [Controller Generator](#controller-generator)
    - [Routes Generator](#routes-generator)
    - [Resource Generator](#resource-generator)
    - [Multiple Resources From File](#multiple-resources-from-file)
- [Testing](#testing)
- [Development Notes](#development-notes)
- [Contributing](#contributing)

Why ?
-----

[](#why-)

I installed Lumen and wanted to use it to create a REST API (since this is the main usage of Lumen). But I didn't find commands which will speed up my workflow. That's why I created this package and included useful commands to build a RESTful API.

This packages was mainly built to be used with Lumen, but it should work fine with Laravel 5 too.

Installation
------------

[](#installation)

Add the generators package to your composer.json by running the command:

`composer require flickerleap/lumen-generators`

Then add the service provider in the file `app/Providers/AppServiceProvider.php`like the following:

```
public function register()
{
    if ($this->app->environment() == 'local') {
        $this->app->register('FlickerLeap\Generators\CommandsServiceProvider');
    }
}
```

**Don't forget to include the application service provider on your `bootstrap/app.php` and to enable Eloquent and Facades if you are using Lumen**

If you run the command `php artisan list` you will see the list of added commands:

```
flickerleap:controller               Generates RESTful controller using the RESTActions trait
flickerleap:controller:rest-actions  Generates REST actions trait to use into controllers
flickerleap:migration                Generates a migration to create a table with schema
flickerleap:model                    Generates a model class for a RESTfull resource
flickerleap:pivot-table              Generates creation migration for a pivot table
flickerleap:resource                 Generates a model, migration, controller and routes for RESTful resource
flickerleap:resources                Generates multiple resources from a file
flickerleap:route                    Generates RESTful routes.

```

Quick Usage
-----------

[](#quick-usage)

To generate a RESTful resource for your application (model, migration, controller and RESTful routes), you simply need to run one single command. For example:

```
php artisan flickerleap:resource task "name;string;required;fillable project_id;integer:unsigned;numeric;fillable,key due;date;;date" --add=timestamps --belongs-to=project

```

will generate these files:

**app/Task.php**

```
