PHP code example of yasinkose / api-responder

1. Go to this page and download the library: Download yasinkose/api-responder 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/ */

    

yasinkose / api-responder example snippets


YasinKose\ApiResponder\ServiceProvider::class,

$app->register(YasinKose\ApiResponder\ServiceProvider::class);

'Respond' => YasinKose\ApiResponder\Facades\ApiResponder::class,

class_alias(YasinKose\ApiResponder\Facades\ApiResponder::class, "Respond");

 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 = [])
bootstrap/app.php
bootstrap/app.php