kristobaljunta/bitly-shortening-class

This package is abandoned and no longer maintained. No replacement package was suggested.

A simple class to shorten links using Bitly API

1.0 2016-04-14 16:41 UTC

This package is not auto-updated.

Last update: 2020-08-21 20:28:32 UTC


README

Bitly shortening class

Simple class for shortening links using bit.ly; provides only link shortening

Usage

Create a Bitly class object and pass an access token to it (you can use generic oauth token for that) like so:

use KristobalJunta\Bitly;

$accessToken = 'your-access-token';

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

You can also choose response format (either text, json or xml). Default is json:

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

Finally, use the shorten method:

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