PHP code example of urlr / urlr-php

1. Go to this page and download the library: Download urlr/urlr-php 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/ */

    

urlr / urlr-php example snippets






ey = getenv('URLR_API_KEY'); // to be defined on your side

// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
$client =  new GuzzleHttp\Client();

$configuration = URLR\Configuration::getDefaultConfiguration()
    ->setApiKey('X-API-KEY', $apiKey);

// Create a link

$linksApi = new URLR\Api\LinksApi($client, $configuration);

$linkCreateRequest = new \URLR\Model\LinkCreateRequest([
    'url' => '',
]);

try {
    $link = $linksApi->linkCreate($linkCreateRequest);
} catch (Exception $e) {
    echo 'Exception when calling LinksApi->linkCreate: ', $e->getMessage(), PHP_EOL;
}
bash
composer