PHPackages                             twodevs/url-shortener - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. twodevs/url-shortener

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

twodevs/url-shortener
=====================

This library helps you to generate shortlinks for long url using different URL Shorteners.

1.0.2(11y ago)119MITPHPPHP &gt;=5.4.8

Since Apr 16Pushed 11y ago1 watchersCompare

[ Source](https://github.com/Zeichen32/UrlShortener)[ Packagist](https://packagist.org/packages/twodevs/url-shortener)[ RSS](/packages/twodevs-url-shortener/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

UrlShortener Library
====================

[](#urlshortener-library)

[![Latest Stable Version](https://camo.githubusercontent.com/70bd5cd07dd17177bba9ff5e1790924a51f883badcd7e14adf8bb11caee698e1/68747470733a2f2f706f7365722e707567782e6f72672f74776f646576732f75726c2d73686f7274656e65722f762f737461626c652e737667)](https://packagist.org/packages/twodevs/url-shortener)[![License](https://camo.githubusercontent.com/be91af6876549f4b09b4cc1c21660d0855eb2381ee71ca70582039bedd9914e2/68747470733a2f2f706f7365722e707567782e6f72672f74776f646576732f75726c2d73686f7274656e65722f6c6963656e73652e737667)](https://packagist.org/packages/twodevs/url-shortener)[![Build Status](https://camo.githubusercontent.com/f282708462293457a42ec091b689e11ef754d66258b1c5c6bd22fcb8b56acdd9/68747470733a2f2f7472617669732d63692e6f72672f5a65696368656e33322f55726c53686f7274656e65722e737667)](https://travis-ci.org/Zeichen32/UrlShortener)

This library helps you to generate shortlinks for long url using different URL Shorteners.

Supportet URL Shortener
-----------------------

[](#supportet-url-shortener)

- [Bitly](https://bitly.com)
- [Google UrlShortener](http://goo.gl/)
- [Tiny-URL](http://www.tiny-url.info/)
- [Ow.ly](http://ow.ly/)
- [Is.gd](http://is.gd/)
- [V.gd](http://v.gd/)

Installation
------------

[](#installation)

The preferred way to install this library is to use [Composer](http://getcomposer.org).

```
    $ composer require twodevs/url-shortener ~1.0
```

Choose a http client support by [Ivory HttpAdapter](https://github.com/egeloen/ivory-http-adapter)

```
    $ composer require guzzlehttp/guzzle ~5.0
```

General Usage
-------------

[](#general-usage)

```
    // Create a client
    $client = new \GuzzleHttp\Client(['defaults' => ['verify' => false]]);

    // Create the Adapter
    $adapter = new \Ivory\HttpAdapter\GuzzleHttpHttpAdapter($client);

    // Create BitlyShortener
    $shorter = new \TwoDevs\UrlShortener\Provider\BitlyProvider($adapter, ['access_token' => 'your-token']));

    // Shorten a long url
    $shortUrl = $shorter->shorten('http://example.org');

    // Expand a short url
    $longUrl = $shorter->expand($shortUrl);

    var_dump( (string) $shortUrl );
    var_dump( (string) $longUrl );
```

Using chain provider
--------------------

[](#using-chain-provider)

```
    // Create a client
    $client = new \GuzzleHttp\Client(['defaults' => ['verify' => false]]);

    // Create the Adapter
    $adapter = new \Ivory\HttpAdapter\GuzzleHttpHttpAdapter($client);

    // Create ChainProvider and attach bitly, google shortener and Tiny-Url
    $shorter  = new \TwoDevs\UrlShortener\Provider\ChainProvider();
    $shorter->addProvider(new \TwoDevs\UrlShortener\Provider\BitlyProvider($adapter, ['access_token' => 'your-token']));
    $shorter->addProvider(new \TwoDevs\UrlShortener\Provider\GoogleProvider($adapter, ['key' => 'your-key']));
    $shorter->addProvider(new \TwoDevs\UrlShortener\Provider\OwlyProvider($adapter, ['key' => 'your-key']));
    $shorter->addProvider(new \TwoDevs\UrlShortener\Provider\TinyUrlProvider($adapter));
    $shorter->addProvider(new \TwoDevs\UrlShortener\Provider\IsgdProvider($adapter));
    $shorter->addProvider(new \TwoDevs\UrlShortener\Provider\VgdUrlProvider($adapter));

    // Shorten a long url
    $shortUrl = $shorter->shorten('http://example.org');

    // Expand a short url
    $longUrl = $shorter->expand($shortUrl);

    var_dump( (string) $shortUrl );
    var_dump( (string) $longUrl );
```

License
-------

[](#license)

The TwoDevs UrlShortener is under the MIT license. For the full copyright and license information, please read the [LICENSE](/LICENSE) file that was distributed with this source code.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

3

Last Release

4049d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bcbd581bf3d0b0bb00e9b71cbbba514a6921d344aacdeb1e955780671a58acbb?d=identicon)[Zeichen32](/maintainers/Zeichen32)

---

Top Contributors

[![Zeichen32](https://avatars.githubusercontent.com/u/1432899?v=4)](https://github.com/Zeichen32 "Zeichen32 (16 commits)")

---

Tags

bitlyurl shortenergoogle url shortenertineURLow.lyis.gdv.gd

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/twodevs-url-shortener/health.svg)

```
[![Health](https://phpackages.com/badges/twodevs-url-shortener/health.svg)](https://phpackages.com/packages/twodevs-url-shortener)
```

###  Alternatives

[hashids/hashids

Generate short, unique, non-sequential ids (like YouTube and Bitly) from numbers

5.4k48.6M278](/packages/hashids-hashids)[yourls/yourls

Your Own URL Shortener

11.9k27.7k1](/packages/yourls-yourls)[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)[php-soap/ext-soap-engine

An ext-soap engine implementation

443.2M7](/packages/php-soap-ext-soap-engine)[shivella/laravel-bitly

Laravel package for generating bitly url

75789.0k1](/packages/shivella-laravel-bitly)[vinelab/url-shortener

URL shortening the easy way.

6217.2k](/packages/vinelab-url-shortener)

PHPackages © 2026

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