PHP code example of narendravaghela / bitly-client

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

    

narendravaghela / bitly-client example snippets




itly\BitlyClient;

$bitlyClient = new BitlyClient('your-access-token');

$options = ['longUrl' => 'http://www.example.com/a-log-url-slug/'];

$response = $bitlyClient->shorten($options);



itly\BitlyClient;

$bitlyClient = new BitlyClient('your-access-token');

$options = [
    'longUrl' => 'http://www.example.com/a-log-url-slug/',
    'format' => 'xml' // pass json, xml or txt
];

$response = $bitlyClient->shorten($options);