1. Go to this page and download the library: Download vince-scarpa/responsibleapi 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/ */
vince-scarpa / responsibleapi example snippets
/**
* Composer Autoloader
*/
/
use responsible\responsible;
// Initiate the API with no options, let ResponsibleAPI take care of all defaults
$responsible = responsible::API();
// Print the response
$responsible::response(true);
$options = array(
/**
* Output type
*/
'requestType' => 'json', // json, array, object, xml, html, debug
/**
* Headers
*/
// Max control age header "Access-Control-Max-Age"
'maxWindow' => 86400, // Defaults to 3600 (1 hour)
/**
* Add custom headers
* Custom headers must be create in the below format
* nothing will happen if not, no errors no added headers
*/
'addHeaders' => array(
['x-my-new-responsible-api', '1.2'],
),
/**
* JWT refresh options
*/
'jwt' => [
'leeway' => 10, // n seconds leeway for expiry
'issuedAt' => time(),
'expires' => time() + 300,
'notBeFor' => 'issuedAt', // issuedAt, or e.g (time()+10)
],
/**
* Rate limiter
*/
'rateLimit' => 1000, // API call Limit
'rateWindow' => 'MINUTE', // Window timeframe SECOND, MINUTE, HOUR, DAY, [CUSTOM/ A POSITIVE INTEGER]
/**
* --- Warning ---
*
* This will override any rate limits
* No maximum calls will be set and the Responsible API
* can run for as many calls and as often as you like
* This should only be used for system admin calls
*/
'unlimited' => false, // Unlimited API calls true / false or don't
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.