Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.

damiencriado/laravel-api-controller

Repository files navigation

itsDamien Laravel API Controller

Latest Stable Version Total Downloads License Build Status Maintainability Test Coverage StyleCI

A simple api controller helper trait, compatible with Lumen 5+ and Laravel 5+. The goal of this project is to make creating API projects simple. Inspired by Jeffrey Way (https://www.laracasts.com)

Installation

composer require itsdamien/laravel-api-controller

Basic Setup/Usage

use ItsDamien\Api\ApiController;

class MyController extends Controller {

    use ApiController;
    
    public function index() {
        return $this->respond(['status' => 'hello world']);
    }
    
}

Api Helper functions

Please browse through the source to see a full list.

//200 response
$this->respond();

//201 response
$this->respondCreated();

//500 error
$this->respondServerError();

//422 error
$this->respondUnprocessable();

//General error
$this->respondWithError('message here');

License

Laravel Api Controller is open-sourced software licensed under the MIT license

About

A simple api controller helper trait, compatible with Lumen 5+ and Laravel 5+.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages