1. Go to this page and download the library: Download linkskipper/sdk 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/ */
linkskipper / sdk example snippets
use LinkSkipper\LinkSkipper;
use LinkSkipper\Exception\JobFailedException;
use LinkSkipper\Exception\TimeoutException;
Ef', maxWaitMs: 60000, pollIntervalMs: 2000);
echo $link->targetUrl, PHP_EOL;
printf("%s (%s) · %d credit(s) · cached=%s\n", $link->provider, $link->tier->value, $link->creditsCharged, $link->cached ? 'yes' : 'no');
} catch (JobFailedException $exception) {
fwrite(STDERR, 'Could not resolve: ' . $exception->reason . PHP_EOL);
} catch (TimeoutException $exception) {
fwrite(STDERR, 'Still pending after the deadline: ' . $exception->jobId . PHP_EOL);
}
use LinkSkipper\Config;
use LinkSkipper\LinkSkipper;
use LinkSkipper\Http\RetryPolicy;
$client = new LinkSkipper(new Config(
apiKey: 'sk_live_...',
baseUrl: 'https://linkskipper.app',
timeoutMs: 30000,
pollIntervalMs: 2000,
maxWaitMs: 120000,
retryPolicy: new RetryPolicy(maxAttempts: 3, initialDelayMs: 500, maxDelayMs: 8000, backoffFactor: 2.0),
));
use LinkSkipper\Config;
use LinkSkipper\Http\Psr18Transport;
$transport = new Psr18Transport($psr18Client, $psr17RequestFactory, $psr17StreamFactory);
$config = new Config(apiKey: 'sk_live_...', transport: $transport);
$result = $client->resolve('https://cuty.io/xyz', idempotencyKey: 'order-42');
if ($result->isDone()) {
echo $result->targetUrl;
} else {
printf("queued at position %d -> %s\n", $result->queuePosition, $result->pollUrl);
}