1. Go to this page and download the library: Download shorter/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/ */
shorter / sdk example snippets
use Shorter\Sdk\ShorterClient;
$client = new ShorterClient(
api_key: 'sk_your_key_here', // or set SHORTER_API_KEY env var
);
// Shorten a URL
$result = $client->shorten('https://example.com');
echo $result->short_url; // https://shorter.sh/xK9mP2
// List your URLs
$list = $client->list(page: 1, limit: 50);
foreach ($list->urls as $url) {
echo "{$url->short_url} → {$url->original_url} ({$url->click_count} clicks)\n";
}
echo "Total clicks: {$list->total_clicks}\n";
// Delete a URL
$client->delete('xK9mP2');