Download the PHP package asmiarowski/lumen-api-generator without Composer
On this page you can find all versions of the php package asmiarowski/lumen-api-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download asmiarowski/lumen-api-generator
More information about asmiarowski/lumen-api-generator
Files in asmiarowski/lumen-api-generator
Package lumen-api-generator
Short Description Artisan generator for API reasource.
License MIT
Homepage https://github.com/asmiarowski/lumen-api-generator
Informations about the package lumen-api-generator
lumen-api-generator
Generates boilerplate for lumen REST API: migration, controller, model, request and route.
Generator creates Eloquent Models and use them in generated controllers. If you want to use this package you are encouraged to uncomment $app->withEloquent
in bootstrap/app.php
.
Installation
Add this to app\Providers\AppServiceProvider inside register() method:
Uncomment in `bootstrap/app.php`
For POST / PUT data to work you either have to send your request with Accept: application/json
header or set up json responses globally in app/Http/Requests/Request.php like so:
Command syntax
Command options
--schema - required, schema of your migration, validators will be set based on fields and types specified.
--softdeletes - optional, add softDeletes() to migration
Column types
http://laravel.com/docs/5.1/migrations#creating-columns
Custom types
- email - puts string type column in your migration and email validation for your request
Column options
foreign, index, unique, default, nullable, first, after, unsigned
Example command
Creates:
app/Http/Controllers/EmailController.php
app/Htpp/Requests/EmailRequest.php
app/Email.php
database/migrations/*timestamp*_create_emails_table.php
And appends resource routes to app/routes.php with pattern for id of the resource.