PHP code example of mpstr24 / laravel-api-responses

1. Go to this page and download the library: Download mpstr24/laravel-api-responses library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mpstr24 / laravel-api-responses example snippets

Bash
public function success()
{
  return $this->apiSuccess();
}
Bash
public function created()
{
    return $this->apiCreated();
}
Bash
public function accepted()
{
    return $this->apiAccepted();
}
Bash
public function noContent()
{
    return $this->apiNoContent();
}
Bash
public function badRequest()
{
    return $this->apiBadRequest();
}
Bash
public function unauthorized()
{
    return $this->apiUnauthorized();
}
Bash
public function forbidden()
{
    return $this->apiForbidden();
}
Bash
public function notFound()
{
    return $this->apiNotFound();
}
Bash
public function teapot()
{
    return $this->apiTeapot();
}
Bash
public function unprocessable()
{
    return $this->apiUnprocessable();
}
Bash
public function tooManyRequests()
{
    return $this->apiTooManyRequests();
}
Bash
public function serverError()
{
    return $this->apiInternalServerError();
}
Bash
public function apiCustomResponse()
{
    return $this->apiCustom('Custom', null, 201);
}