PHP code example of kristobaljunta / bitly-shortening-class

1. Go to this page and download the library: Download kristobaljunta/bitly-shortening-class 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/ */

    

kristobaljunta / bitly-shortening-class example snippets


use KristobalJunta\Bitly;

$accessToken = 'your-access-token';

$bitly = new Bitly([
    'access_token' => $accessToken
]);

$bitly = new Bitly([
    'access_token' => $accessToken,
    'response_type' => 'text'
]);

$shortenedUrl = $bitly->shorten('http://example.com');