PHP code example of sineverba / bitly-php-api-wrapper
1. Go to this page and download the library: Download sineverba/bitly-php-api-wrapper 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/ */
sineverba / bitly-php-api-wrapper example snippets
$ composer
itlywrap\Auth\Auth;
use Bitlywrap\Adapter\Adapter;
use Bitlywrap\Wrapper\Wrapper;
$token = 'your_generic_access_token';
$auth = new Auth($token);
$adapter = new Adapter($auth);
$wrapper = new Wrapper($adapter);
$long_url = 'http://www.example.com';
$short_url = $wrapper->getShortLink($long_url);
echo $short_url; // http://bit.ly/2HzJUKT