PHPackages                             bitly-api/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. bitly-api/sdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

bitly-api/sdk
=============

PHP library for Bitly API.

1.7.0(8mo ago)0201↓50%[4 PRs](https://github.com/bitly-community/bitly-php/pulls)MITPHPPHP &gt;=8.0CI passing

Since Feb 26Pushed 5mo agoCompare

[ Source](https://github.com/bitly-community/bitly-php)[ Packagist](https://packagist.org/packages/bitly-api/sdk)[ Docs](https://github.com/bitly-community/bitly-php)[ Fund](https://www.buymeacoffee.com/remarkablemark)[ Fund](https://b.remarkabl.org/teespring)[ RSS](/packages/bitly-api-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (7)Versions (13)Used By (0)

bitly-php
=========

[](#bitly-php)

[![packagist](https://camo.githubusercontent.com/d6e2ed7fd760de0d0534c0f144508201597f052f63e4f9bf2aeadb205490c341/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6269746c792d6170692f73646b)](https://packagist.org/packages/bitly-api/sdk)[![build](https://github.com/bitly-community/bitly-php/actions/workflows/build.yml/badge.svg)](https://github.com/bitly-community/bitly-php/actions/workflows/build.yml)[![test](https://github.com/bitly-community/bitly-php/actions/workflows/test.yml/badge.svg)](https://github.com/bitly-community/bitly-php/actions/workflows/test.yml)

PHP library for [Bitly](https://bitly.com/). Code is generated using the [OpenAPI spec](https://dev.bitly.com/docs/sdks/openapi-30/). See the [API reference](https://dev.bitly.com/api-reference).

Requirements
------------

[](#requirements)

### Version

[](#version)

PHP &gt;=8.0

### API Key

[](#api-key)

Generate an [access token](https://app.bitly.com/settings/api/).

Install
-------

[](#install)

Install the package with [Composer](https://getcomposer.org/):

```
composer require bitly-api/sdk
```

If you're missing a package providing `psr/http-client-implementation`:

```
composer require php-http/guzzle7-adapter
```

Add [autoloading](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
require_once 'vendor/autoload.php';
```

Usage
-----

[](#usage)

Instantiate the SDK:

```
use Bitly\Bitly;

$bitly = new Bitly('YOUR_API_KEY');

$client = $bitly->client;
```

Convert a long URL to a Bitlink:

```
use Bitly\Bitly;
use Bitly\Model\Shorten;

$bitly = new Bitly('YOUR_API_KEY');

$shorten = new Shorten();
$shorten->setLongUrl('https://example.com/my-long-url');
$response = $bitly->client->createBitLink($shorten);
```

Handle an API error:

```
use Bitly\Bitly;

$bitly = new Bitly('YOUR_API_KEY');

try {
    $bitly->client->getBitlink('http://bit.ly/2OUJim0');
} catch (Throwable $exception) {
    echo $exception->getMessage();
    echo $exception->getCode();
}
```

Scripts
-------

[](#scripts)

### `composer build`

[](#composer-build)

Generate the code:

```
composer build
```

### `composer clean`

[](#composer-clean)

Delete the `lib/` directory:

```
composer clean
```

### `composer test`

[](#composer-test)

Run the tests:

```
composer test
```

About This Package
------------------

[](#about-this-package)

This package is automatically generated by [Jane](https://github.com/janephp/janephp).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance67

Regular maintenance activity

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Recently: every ~8 days

Total

8

Last Release

241d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ecf70b12e323ab9e9e4c48cef72c2be17f5119ea92f88a0b2555bf959d3b889?d=identicon)[remarkablemark](/maintainers/remarkablemark)

---

Top Contributors

[![remarkablemark](https://avatars.githubusercontent.com/u/10594555?v=4)](https://github.com/remarkablemark "remarkablemark (45 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

bitlybitly-apibitly-php-sdkcomposercomposer-packagejanephplibrarypackagephpphp-libraryphp-sdksdksdk-phpphpapisdkrestbitly

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/bitly-api-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/bitly-api-sdk/health.svg)](https://phpackages.com/packages/bitly-api-sdk)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
