PHP code example of thomas-institut / standard-api

1. Go to this page and download the library: Download thomas-institut/standard-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/ */

    

thomas-institut / standard-api example snippets


use ThomasInstitut\StandardApi\SuccessResponse;

$response = new SuccessResponse();
// $response->result will be ApiResult::Success
// $response->timeStamp will be set to current time

use ThomasInstitut\StandardApi\ErrorResponse;

$response = new ErrorResponse('An error occurred', 404);
// $response->result will be ApiResult::Error
// $response->message will be 'An error occurred'
// $response->httpStatus will be 404