kristobaljunta / bitly-shortening-class
A simple class to shorten links using Bitly API
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/kristobaljunta/bitly-shortening-class
Requires
- php: >=5.3.0
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');