yasinkose / api-responder
A api responder
v1.0.3
2022-04-24 13:51 UTC
Requires
- php: >=7.4
- ext-json: *
- illuminate/support: ^6.0|^7.0|^8.0|^9.0
Requires (Dev)
- orchestra/testbench: ^4.0|^5.0|^6.0
- phpunit/phpunit: ^8.4|^9.0
This package is auto-updated.
Last update: 2024-12-11 15:10:15 UTC
README
Description
A Simple Laravel package built to generate API Respond.
Installation
To get started, Install via composer:
composer require yasinkose/api-responder
Laravel
Register Service Provider
Append the following line to the providers
key in config/app.php
to register the package:
YasinKose\ApiResponder\ServiceProvider::class,
or if you're using Lumen, Add the following snippet to the bootstrap/app.php
file under the providers section
as follows:
$app->register(YasinKose\ApiResponder\ServiceProvider::class);
Register Facades
If you're using Laravel, Add ApiResponder
Facades
to the aliases
key:
'Respond' => YasinKose\ApiResponder\Facades\ApiResponder::class,
or if you're using Lumen Add the following snippet to the bootstrap/app.php
class_alias(YasinKose\ApiResponder\Facades\ApiResponder::class, "Respond");
Usage
Respond::ok(string $message = "OK", $attr = []) Respond::unAuthenticated(string $message = "Unauthorized", $errors = []) Respond::forbidden(string $message = "Forbidden", $errors = []) Respond::error(string $message = null, $errors = []) Respond::created($attr = null) Respond::failedValidation(string $message = "Unprocessable Entity", $errors = []) Respond::noContent(string $message = "No Content", $errors = [])
Security
If you discover any security related issues, please email instead of using the issue tracker.
Contributors ✨
Thanks goes to these people: