| Server IP : 104.21.37.246 / Your IP : 104.23.243.32 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/cp648411/www/simded.com/vendor/narendravaghela/bitly-client/ |
Upload File : |
# Bitly PHP Client
[](https://travis-ci.org/narendravaghela/bitly-client)
[](https://packagist.org/packages/narendravaghela/bitly-client)
[](https://packagist.org/packages/narendravaghela/bitly-client)
[](https://packagist.org/packages/narendravaghela/bitly-client)
PHP client library to access Bitly APIs. Register your account at [Bitly.com](https://bitly.com/) and get your access token from [here](https://bitly.com/a/oauth_apps).
## Requirements
This library has the following requirements:
* PHP 5.6.x or greater.
## Installation
You can install this library into your application using [composer](http://getcomposer.org).
```
composer require narendravaghela/bitly-client
```
## Usage
Once you install this library, load it using the composer autoload option and use the `BitlyClient` class object. See below example,
```php
<?php
require 'vendor/autoload.php';
use Bitly\BitlyClient;
$bitlyClient = new BitlyClient('your-access-token');
$options = ['longUrl' => 'http://www.example.com/a-log-url-slug/'];
$response = $bitlyClient->shorten($options);
```
### Response format
Bitly suppoerts `json`, `xml` and `txt` response types. You can specify the response type in your `$options` array. The default response format is `json`.
```php
<?php
require 'vendor/autoload.php';
use Bitly\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);
```
We recommend to use `json` and `xml` formats only as `txt` response sometimes does not work.
## Documentation
As of now, this library provides API methods for following modules.
* [Links](docs/Links.md)
## Reporting Issues & Contributing
If you have a problem with this libray or any bug, please open an issue on [GitHub](https://github.com/narendravaghela/bitly-client/issues). Also, if you have solution to any existing bug, create a Pull Request. This library follows PSR-2 standards, so please make sure you follow the same while making changes.