Download the PHP package asmiarowski/laravel5-api-generator without Composer
On this page you can find all versions of the php package asmiarowski/laravel5-api-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download asmiarowski/laravel5-api-generator
More information about asmiarowski/laravel5-api-generator
Files in asmiarowski/laravel5-api-generator
Package laravel5-api-generator
Short Description Artisan generator for API reasource.
License MIT
Homepage https://github.com/asmiarowski/laravel5-api-generator
Informations about the package laravel5-api-generator
laravel5-api-generator
Generates boilerplate for laravel REST API: migration, controller, model, request and route.
Installation
Add this to app\Providers\AppServiceProvider inside boot() method:
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
- url - puts text type column in your migration and url validation in 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.