sineverba / bitly-php-api-wrapper
PHP Wrapper for APIv4 Bit.ly
Installs: 1 233
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: >=5.6
- ext-json: *
- guzzlehttp/guzzle: ^6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2
- php-coveralls/php-coveralls: ^2
- phpunit/phpunit: ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0
README
The Bit.ly name is trademark of Bit.ly!
Simple PHP wrapper for the Bit.ly API V4.
Support PHP >= 5.6
If you like or use this project, star it!
Install
$ composer require sineverba/bitly-php-api-wrapper
Usage
- Get your Generic Access Token from Bit.ly. See also https://support.bitly.com/hc/en-us/articles/230647907-How-do-I-find-my-OAuth-access-token-
<?php require_once ('vendor/autoload.php'); use Bitlywrap\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
Contributions
Contributions are welcome and will be fully credited.