Skip to content

A Simple Laravel package built to generate API Respond.

License

Notifications You must be signed in to change notification settings

YasinKose/api-responder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Api Responder

Packagist Packagist Packagist

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:

About

A Simple Laravel package built to generate API Respond.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages