Download the PHP package arrilot/laravel-api-generator without Composer

On this page you can find all versions of the php package arrilot/laravel-api-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-api-generator

Total Downloads Scrutinizer Quality Score MIT License

Laravel Api Generator (No longer supported)

Two simple tools for building REST APIs with fractal: console generator and API skeleton

Introduction

This package provides two features

  1. Console generator which creates Controller, Fractal Transformer and routes in a single command.

  2. Basic REST API skeleton that can be really helpful if you need something standard. It's 100% optional.

If you do not use Fractal for your transformation layer, this package is probably not the right choice for you.

Installation

1) Run

2) Register a service provider in the app.php configuration file

3) Copy basic folder structure to app/Api and check what you got there. If you need you can use different paths later.

Usage

Generator

The only console command that is added is .

Imagine you need to create a rest api to list/create/update etc users from users table. To achieve that you need to do lots of boilerplate operations - create controller, transformer, set up needed routes.

does all the work for you.

1) You may have noticed that after installation you already have a routes file app/Api/routes.php which looks like that:

Feel free to change it if you like.

The generator adds to the end of this file.

As you can see it's smart enough to detect some route groups and treat this situation properly.

2) Then the generator creates a controller that extends base api controller.

You can customize this stub as much as you want.

3) Finally the generator creates a fractal Transformer

This stub is customizable too.

Skeleton

You may have noticed that controller which has just been generated includes two public methods - model() and transformer() That's because those methods are the only thing that you need in your controller to set up a basic REST API if you use the Skeleton.

The list of routes that are available out of the box:

  1. GET api/v1/users
  2. GET api/v1/users/{id}
  3. POST api/v1/users
  4. PUT api/v1/users/{id}
  5. DELETE api/v1/users/{id}

Request and respone format is json Fractal includes are supported via $_GET['include']. Validation rules for create and update can be set by overwriting rulesForCreate and rulesForUpdate in your controller.

This skeleton is not a silver bullet but in many cases it can be either exactly what you need or can be used as a decent starting point for your api.

You can check https://github.com/Arrilot/laravel-api-generator/blob/master/src/Skeleton/BaseController.php for more info.

If you don't like the Skeleton just stop inheriting it in the base controller - Api\Controllers\Controller and overwrite the controller stub in your config to remove model() and transformer() methods.

Configuration

All paths and generator's stubs are configurable.

https://github.com/Arrilot/laravel-api-generator/blob/master/src/config/config.php


All versions of laravel-api-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version >=5.5
league/fractal Version 0.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package arrilot/laravel-api-generator contains the following files

Loading the files please wait ....