PHP code example of riidme / php-sdk
1. Go to this page and download the library: Download riidme/php-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/ */
riidme / php-sdk example snippets
use Riidme\Client;
use Riidme\Exception\RiidmeException;
// Initialize using factory method
$client = Client::create([
'base_url' => 'https://riid.me', // Optional
'timeout' => 5, // Optional
'retries' => 3 // Optional
]);
try {
$result = $client->shorten('https://example.com/very/long/url');
echo $result->getShortUrl(); // https://riid.me/abc123
// or simply
echo $result; // https://riid.me/abc123
} catch (RiidmeException $e) {
echo "Error: " . $e->getMessage();
}
bash
composer