PHPackages                             adeb6600/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. adeb6600/url-shortener

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

adeb6600/url-shortener
======================

URL shortening the easy way.

v1.1.1(11y ago)022MITPHPPHP &gt;=5.4.0

Since May 11Pushed 10y ago1 watchersCompare

[ Source](https://github.com/adeb6600/url-shortener)[ Packagist](https://packagist.org/packages/adeb6600/url-shortener)[ RSS](/packages/adeb6600-url-shortener/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (7)Versions (3)Used By (0)

URL Shortener PHP Package
=========================

[](#url-shortener-php-package)

[![Latest Stable Version](https://camo.githubusercontent.com/1ceea93e3bdf361337f6dabd6d661addbb0744c2e9e87ed2d9e06bbee07e51ed/68747470733a2f2f706f7365722e707567782e6f72672f76696e656c61622f75726c2d73686f7274656e65722f762f737461626c65)](https://packagist.org/packages/vinelab/url-shortener)[![Latest Unstable Version](https://camo.githubusercontent.com/53ae70dcee5a2dff6da5f8b330bcb6f5f9389ceb508e96677aae83c1b8d39cb9/68747470733a2f2f706f7365722e707567782e6f72672f76696e656c61622f75726c2d73686f7274656e65722f762f756e737461626c65)](https://packagist.org/packages/vinelab/url-shortener)[![Total Downloads](https://camo.githubusercontent.com/f23fdc8b549b0233220ea90768dec3f72856691509020d29bf51d019cb020cde/68747470733a2f2f706f7365722e707567782e6f72672f76696e656c61622f75726c2d73686f7274656e65722f646f776e6c6f616473)](https://packagist.org/packages/vinelab/url-shortener)[![Build Status](https://camo.githubusercontent.com/9c98fdef53c3ec3d586d8cf68622dc71dc92376492a0050a4081ce758f9c0c05/68747470733a2f2f7472617669732d63692e6f72672f56696e656c61622f75726c2d73686f7274656e65722e737667)](https://travis-ci.org/Vinelab/url-shortener)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/bc5e21d6464da925307eb5be6b5010262cc7e63044b70a4af9135e3ef83c5d69/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f56696e656c61622f75726c2d73686f7274656e65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Vinelab/url-shortener/?branch=master)[![License](https://camo.githubusercontent.com/d53204f4d2614a9e759e244653f2b8b7891c99735733450384da992d12479f7d/68747470733a2f2f706f7365722e707567782e6f72672f76696e656c61622f75726c2d73686f7274656e65722f6c6963656e7365)](https://packagist.org/packages/vinelab/url-shortener)

**`vinelab/url-shortener`** is a PHP framework agnostic Package that makes it easy to shorten your URL's, with your favourite URL Shortening provider such as (Bit.ly, Goo.gl, Ow.ly).

*The URL Shortening Providers are online services that takes long URLs and squeezes them into fewer characters to make the link easier to share, tweet, or send by email.*

The package requires PHP 5.4+ and comes bundled with a Laravel 5 Facade and a Service Provider to simplify the optional framework integration and follows the FIG standard PSR-4 to ensure a high level of interoperability between shared PHP code and is fully unit-tested.

Highlights
----------

[](#highlights)

- Supportes [Bit.ly](https://bitly.com/)

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

[](#installation)

The recommended way to install this package is via `Composer`.

#### Via Composer

[](#via-composer)

A. Run this composer command:

```
	composer require vinelab/url-shortener:*
```

B. **Or** manually add the package to your `composer.json` and run `composer update`.

```
    {
        "require": {
            "vinelab/url-shortener": "*"
        }
    }
```

Integrations
------------

[](#integrations)

`url-shortener` is framework agnostic and as such can be integrated easily natively or with your favorite framework.

### Laravel:

[](#laravel)

The `url-shortener` package has optional support for Laravel 5 and it comes bundled with a Service Provider for easier integration.

After you have installed the package correctly, just follow the instructions.

.1. Register the service provider in your `config/app.php`:

```
    'providers' => array(
        ...
		'Vinelab\UrlShortener\UrlShortenerServiceProvider'
    ),
```

The service provider will automatically alias the `Vinelab\UrlShortener\Shorten` class, so you can easily use the `Shorten` facade anywhere in your app.

.2. Publish the configuration file:

```
php artisan vendor:publish --provider ='Vinelab\UrlShortener\UrlShortenerServiceProvider'
```

Configuration
-------------

[](#configuration)

.1. Open `url-shortener.php` and select your default provider:

```
	'default' => 'bitly',
```

.2. Then add your provider token:

```
        'bitly' => [
            'domain' => 'https://api-ssl.bitly.com',
            'endpoint' => '/v3/shorten',
            'token' => 'YOUR-TOKEN-HERE',
        ],
```

Note: It's very recommended to not add your token (any sensetive data) to the config file instead reference it to a `.env` variable.

And to do so:

1. replace the `'token' => 'YOUR-TOKEN-HERE',` with `'token' => env('BITLY_TOKEN'),`
2. open your `.env` file and add the token variable there with the token value: `BITLY_TOKEN=YOUR-TOKEN-HERE`.
3. add the variable `BITLY_TOKEN=` to the `.env.example` for other developers.

Usage
-----

[](#usage)

##### With Laravel:

[](#with-laravel)

The easiest way is to use it is by the `Shorten` facade.

```
$long_url = 'http://testing.tst/something/12345/something-else/54321';

$short_url = Shorten\Shorten::url($long_url); // returns the short version of the long_url as a string
```

Test
----

[](#test)

To run the tests, run the following command from the project folder.

```
$ ./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

### Support new provider

[](#support-new-provider)

To add support for a new URL shortening provider:

1. write a driver for your URL Shortener service. check the `Bitly` driver `Vinelab\UrlShortener\Drivers\Bitly` class.
2. add you driver configuration to the config file.
3. write tests for your drvier.
4. update the `README` file
5. check out the [Contribution Guide](https://github.com/Vinelab/url-shortener/blob/master/CONTRIBUTING.md) for general details.

Support
-------

[](#support)

[On Github](https://github.com/Vinelab/url-shortener/issues)

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Mahmoud Zalt](https://github.com/Mahmoudz)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/Vinelab/url-shortener/blob/master/LICENSE) for more information.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

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

Total

3

Last Release

4054d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/50a5986ea3e8bf6ac9e9d564349985eb547a0c86469c220e6872aeb016bb9e96?d=identicon)[adeb6600](/maintainers/adeb6600)

---

Top Contributors

[![Mahmoudz](https://avatars.githubusercontent.com/u/1983984?v=4)](https://github.com/Mahmoudz "Mahmoudz (45 commits)")[![adeb6600](https://avatars.githubusercontent.com/u/1121388?v=4)](https://github.com/adeb6600 "adeb6600 (2 commits)")[![Mulkave](https://avatars.githubusercontent.com/u/2647333?v=4)](https://github.com/Mulkave "Mulkave (2 commits)")

---

Tags

urllaravelbitlyurl shortenershortenow.lygoogl

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[vinelab/url-shortener

URL shortening the easy way.

5917.2k](/packages/vinelab-url-shortener)[illuminate/session

The Illuminate Session package.

9938.5M823](/packages/illuminate-session)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

123397.6k](/packages/laragear-preload)[waavi/url-shortener

Url Shortener for Laravel 5 with support for Google and Bitly drivers.

64178.1k](/packages/waavi-url-shortener)

PHPackages © 2026

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