PHP code example of mrgarest / echo-api

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

    

mrgarest / echo-api example snippets


return EchoApi::success();

$data = [
    'user' => [
        'id' => 21314,
        'role' => 'user',
        'email' => '[email protected]'
    ]
];

return EchoApi::success($data);

$httpStatus = Response::HTTP_NOT_FOUND; // 404 Not Found
return EchoApi::httpError($httpStatus);

return EchoApi::findError('EXAMPLE');

$data = [
    'error' = [
        'uuid' => '21e38f4d-3be8-457c-98da-3059a947e75b'
    ],
    'count' => 0,
    'data' => null
];
return EchoApi::httpError(Response::HTTP_NOT_FOUND, $data);

composer