eventhomes/laravel-apicontroller
Simplified API controller, inspired by Jeffrey Way. Compatible with Laravel 5+ and Lumen 5+.
94,257
7
| Install | |
|---|---|
composer require eventhomes/laravel-apicontroller |
|
| Latest Version: | 2.0.1 |
| PHP: | ^7.2 |
| License: | MIT |
| Last Updated: | Mar 3, 2020 |
| Links: | GitHub · Packagist |
Maintainer: lostincode
Laravel 5 / Lumen 5 Api Controller
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 eventhomes/laravel-apicontroller
Basic Setup/Usage
...
use EventHomes\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');
Add Fractal Helpers
Please use [https://github.com/eventhomes/laravel-fractalhelper]
Related Packages
ftxrc/apicontroller
Simplified API controller, inspired by Jeffrey Way. Compatible with Laravel 5+ a...
37
2
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 2.0.1 | ^7.2 | 6.*| | MIT | |
| 2.0.0 | ^7.2 | 5.8.*| | MIT | |
| v1.1.0 | ^7.2 | 5.8.*| | MIT | |
| v1.0 | ^7.2 | 5.8.*| | MIT | |
| v0.1.9 | ^7.2 | 5.8.*| | MIT | |
| 0.1.8 | >=5.5.9 | ~5.0 | MIT | |
| 0.1.7 | >=5.5.9 | ~5.0 | MIT | |
| 0.1.6 | >=5.5.9 | ~5.0 | MIT | |
| 0.1.5 | >=5.5.9 | ~5.0 | MIT | |
| 0.1.4 | >=5.5.9 | ~5.0 | MIT | |
| 0.1.3 | >=5.5.9 | ~5.0 | MIT | |
| 0.1.2 | >=5.5.9 | ~5.0 | MIT | |
| 0.1.1 | >=5.5.9 | ~5.0 | MIT | |
| 0.1.0 | >=5.5.9 | ~5.0 | MIT |