PHP code example of vdhicts / rebrandly-api-client

1. Go to this page and download the library: Download vdhicts/rebrandly-api-client 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/ */

    

vdhicts / rebrandly-api-client example snippets


use Vdhicts\Rebrandly;

// Initialize the client and the Rebrandly instance
$client = new Rebrandly\Client('API_KEY');
$rebrandly = new Rebrandly\Rebrandly($client);

// Access the endpoints
$linksEndpoint = $rebrandly->links();

$links = $rebrandly->links()->list();

$links = $rebrandly->links()->list(new Options(['orderBy' => 'clicks', 'orderDir' => 'asc']));

$link = new Rebrandly\Models\Link();
$link->setDestination('https://time-tracker.vdhicts.nl');
$link->setSlashtag('time-tracker');
$link->setDomain($domain);

$rebrandly->links()->create($link);

$domain = new Rebrandly\Models\Domain();
$domain->setFullName('yourdomain.tld');

$link->setDomain($domain);

$rebrandly->links()->create($link);

$client = new Rebrandly\Client(config('rebrandly.api_key'));