PHPackages                             serbanblebea/urlshortener - 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. [Database &amp; ORM](/categories/database)
4. /
5. serbanblebea/urlshortener

ActiveLibrary[Database &amp; ORM](/categories/database)

serbanblebea/urlshortener
=========================

This is a package for creating short url links that track conversion for a Laravel website or web app.

v1.2.1(7y ago)3963MITPHPPHP &gt;=5.5.0

Since May 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/SerbanBlebea/url-shortener)[ Packagist](https://packagist.org/packages/serbanblebea/urlshortener)[ RSS](/packages/serbanblebea-urlshortener/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

URL-Shortener
=============

[](#url-shortener)

[![](https://raw.githubusercontent.com/SerbanBlebea/url-shortener/master/img/url-shortener-logo.png)](https://raw.githubusercontent.com/SerbanBlebea/url-shortener/master/img/url-shortener-logo.png)

Menu
----

[](#menu)

- About
- Install
- Use
- Testing

About URL-Shortener
-------------------

[](#about-url-shortener)

URL-Shortener is a package for creating short url links that track conversions for Laravel apps or websites.

Just like bit.ly, you can create a url shortening service in your Laravel app.

Easy to install and easy to use.

Just read this file and let me know if I can help.

Install URL-Shortener
---------------------

[](#install-url-shortener)

Add this to the `composer.json` file:

```
{
    "require": {
        "serbanblebea/urlshortener": "1.0"
    }
}
```

Or just use the command line:

```
composer require serbanblebea/urlshortener

```

Then add the Service Provider and the Facade to the config/app.php file

### UrlShortenerServiceProvider

[](#urlshortenerserviceprovider)

```
'providers' => [
    SerbanBlebea\UrlShortener\UrlShortenerServiceProvider::class,
];
```

### ShortUrl Facade

[](#shorturl-facade)

```
'aliases' => [
    'ShortUrl' => SerbanBlebea\UrlShortener\Facades\ShortUrl::class,
];
```

Use URL-Shortener
-----------------

[](#use-url-shortener)

URL-Shortener is very easy to use:

### Step 1. Create the table

[](#step-1-create-the-table)

Before using the package, use the command line `php artisan migrate` to migrate the database table `links`.

This will be used to store the data for the short urls and the visitor count for every link.

### Step 2. Publish the config file

[](#step-2-publish-the-config-file)

Run `php artisan vendor:publish` and select the package name to publish the config file `url-shortener.php` in the `config` folder.

**!IMPORTANT** If you change the `special_route_param`, all your existing linksspread across the internet will be nulled, so I would setup this option before using the package in production

### Step 3. Create your first short url

[](#step-3-create-your-first-short-url)

After you migrated the table, it's time to create your first short url:

```
