2017 © Pedro Peláez
 

library laravel-api

Package helping with API development

image

bwt-team/laravel-api

Package helping with API development

  • Saturday, April 7, 2018
  • by BWT group
  • Repository
  • 0 Watchers
  • 0 Stars
  • 120 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 35 % Grown

The README.md

English description | Russian description , (*1)

Laravel 5 API

Latest Stable Version ![Latest Unstable Version][ico-unstable-version] License, (*2)

This package allows to easily and quickly setup basics for API., (*3)

Content

Installation

Install this package with composer using the following command:, (*4)

composer require bwt-team/laravel-api

Setup in Laravel

When composer updated, add service provider into providers array in config/app.php., (*5)

BwtTeam\LaravelAPI\Providers\ApiServiceProvider::class

This service provider will register api macros for more comfortable work. You will have the following format of call available in api format:, (*6)

response()->api($data)

In full format it will look as following:, (*7)

new \BwtTeam\LaravelAPI\Response\ApiResponse($data)

Also, this service provider will allow to publish config file in order to update package settings according to your needs. Use the following command for publication:, (*8)

php artisan vendor:publish --provider="BwtTeam\LaravelAPI\Providers\ApiServiceProvider" --tag=config

To make all responses (including alerts etc) be sent in the same format, change class parent to \BwtTeam\LaravelAPI\Exceptions\Handler in App\Exceptions\Handler class, (*9)

class Handler extends \BwtTeam\LaravelAPI\Exceptions\Handler

And middleware \BwtTeam\LaravelAPI\Middleware\Api should be connected to specific path (or the whole app) to make this path be handled as API method., (*10)

If you are using App\Http\Requests class instances for validation, you need to inherit from BwtTeam\LaravelAPI\Requests\ApiRequest, rather than Illuminate\Foundation\Http\FormRequest., (*11)

Setup in Lumen

After composer update register a service provider, by adding the following lines into bootstrap/app.php:, (*12)

$app->register(\BwtTeam\LaravelAPI\Providers\ApiServiceProvider::class);

Copy config file vendor/bwt-team/laravel-api/config/api.php into config directory, which is stored in root directory (or create it yourself if it is missing) and set it up according to your needs. To load settings from this file in bootstrap/app.phpadd the following lines:, (*13)

$app->configure('api');

To make all responses (including alerts etc) be sent in the same format, change class parent to BwtTeam\LaravelAPI\Exceptions\LumenHandler in App\Exceptions\Handler, (*14)

class Handler extends \BwtTeam\LaravelAPI\Exceptions\LumenHandler

And middleware \BwtTeam\LaravelAPI\Middleware\Api should be connected to specific path (or the whole app) to make this path be handled as API method., (*15)

License

This package is using MIT., (*16)

The Versions

07/04 2018

dev-master

9999999-dev

Package helping with API development

  Sources   Download

MIT

The Requires

 

The Development Requires

by Chesanovskiy Denis

laravel api lumen

07/04 2018

v1.1.0

1.1.0.0

Package helping with API development

  Sources   Download

MIT

The Requires

 

The Development Requires

by Chesanovskiy Denis

laravel api lumen

07/04 2018

dev-develop

dev-develop

Package helping with API development

  Sources   Download

MIT

The Requires

 

The Development Requires

by Chesanovskiy Denis

laravel api lumen

18/01 2018

v1.0.2

1.0.2.0

Package helping with API development

  Sources   Download

MIT

The Requires

 

The Development Requires

by Chesanovskiy Denis

laravel api lumen

28/03 2017

v1.0.1

1.0.1.0

Package helping with API development

  Sources   Download

MIT

The Requires

 

The Development Requires

by Chesanovskiy Denis

laravel api lumen

28/01 2017

v1.0.0

1.0.0.0

Package helping with API development

  Sources   Download

MIT

The Requires

 

The Development Requires

by Chesanovskiy Denis

laravel api lumen