1. Go to this page and download the library: Download sharpapi/php-core 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/ */
$client = new SharpApiClient('your-api-key');
// Change the throttle limit (default: 60)
$client->setRequestsPerMinute(120);
// Disable throttling entirely (pass 0)
$client->setRequestsPerMinute(0);
$limiter = $client->getRateLimiter();
// Non-blocking check — returns true if a request can proceed without waiting
$limiter->canProceed();
// How many requests are available in the current window
$limiter->remaining(); // e.g. 42
// After an API call, cache the server-reported state
$state = $client->getRateLimitState();
// $state = ['limit' => 60, 'remaining' => 58]
cache()->put('sharpapi_rate_state', $state, 60);
// In the next process/request, restore it
$client->setRateLimitState(cache()->get('sharpapi_rate_state'));
if ($client->canMakeRequest()) {
// Server-reported remaining > 0 (or no server data yet)
}
$client = new SharpApiClient('your-api-key');
$client->ping();
echo $client->getRateLimitLimit(); // e.g. 60 (requests per window)
echo $client->getRateLimitRemaining(); // e.g. 58 (remaining in current window)
// Max automatic retries on HTTP 429 (default: 3)
$client->setMaxRetryOnRateLimit(5);
// Threshold below which polling intervals are increased (default: 3)
$client->setRateLimitLowThreshold(5);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.