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

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

cedaesca/urlshortener
=====================

Shorten URL's using your own domain

v0.1.16(6y ago)6251[1 issues](https://github.com/cedaesca/urlshortener/issues)[1 PRs](https://github.com/cedaesca/urlshortener/pulls)MITPHP

Since May 30Pushed 6y agoCompare

[ Source](https://github.com/cedaesca/urlshortener)[ Packagist](https://packagist.org/packages/cedaesca/urlshortener)[ RSS](/packages/cedaesca-urlshortener/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)DependenciesVersions (14)Used By (0)

[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)

URL Shortener
=============

[](#url-shortener)

Shorten URL's using your own domain

Getting Started
---------------

[](#getting-started)

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

### Prerequisites

[](#prerequisites)

```
Laravel 5.8+ (Not tested in previous versions)

```

### Installing

[](#installing)

1. Download it into your Laravel app using composer

```
composer require cedaesca/urlshortener

```

2. Publish the packages files

```
php artisan vendor:publish

```

3. Run the migrations.

```
php artisan migrate

```

Customizing the URL's code length
---------------------------------

[](#customizing-the-urls-code-length)

1. Go to the config file located on `config/cedaesca/URLShortener.php`
2. Change the `length` value for that of your preference.

URLShortener Facade
-------------------

[](#urlshortener-facade)

You have to add the URLShortener facade to your controller:

```
use cedaesca\URLShortener\Facades\URLShortener;
```

Then you'll have access to the `create` and `redirect` methods.

Shorten URL's
-------------

[](#shorten-urls)

Use the `create` static method to shorten a given URL. This method receives the request as argument and returns an instance of the model if was successfully created or false if not:

```
URLShortener::create($request);
```

Redirecting users
-----------------

[](#redirecting-users)

First off, the redirection route expect a `shortlink` parameter, make sure to name it like that. Later, you can redirect the user to the expected target by returning Laravel's redirect response and giving the returning value of the `target` method as an argument. The `target` method also receives the `\Illuminate\Http\Request` instance.

```
Route::get('/r/{code}', 'UrlShortenerController@redirect')->name('rthis');
```

```
return redirect(URLShortener::target($request));
```

Logging redirected clients
--------------------------

[](#logging-redirected-clients)

You may want to track some statistics with your shortened URL's. At the moment you can track their user agent, their IP Address and the timestamps. You can decide what to do with that info.

To achieve this, call the log method before the target one in your redirect response. Give the ``\\Illuminate\\Http\\Request`as the argument and now you can leave the`target` argument blank.

```
return redirect(URLShortener::log($request)->target());
```

Default redirect
----------------

[](#default-redirect)

If the code given as argument is invalid, the `redirect` method will redirect the user to a default route. Change this from the config file.

1. Go to the config file located on `config/cedaesca/URLShortener.php`
2. Change the `default_redirect` value for that of your preference.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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 ~6 days

Recently: every ~16 days

Total

12

Last Release

2469d ago

### Community

Maintainers

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

---

Top Contributors

[![cedaesca](https://avatars.githubusercontent.com/u/26552106?v=4)](https://github.com/cedaesca "cedaesca (50 commits)")

### Embed Badge

![Health badge](/badges/cedaesca-urlshortener/health.svg)

```
[![Health](https://phpackages.com/badges/cedaesca-urlshortener/health.svg)](https://phpackages.com/packages/cedaesca-urlshortener)
```

###  Alternatives

[mult1mate/cron-manager

Flexible cron tasks manager for MVC-type applications

40338.5k3](/packages/mult1mate-cron-manager)[michielkempen/nova-polymorphic-field

A Laravel Nova field container allowing to depend on other fields values

6781.9k1](/packages/michielkempen-nova-polymorphic-field)[fomvasss/laravel-meta-tags

A package to manage SEO (meta-tags, xml-fields, etc.)

3028.9k](/packages/fomvasss-laravel-meta-tags)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)[sherlockode/configuration-bundle

Symfony bundle for user-defined configuration values

3118.7k](/packages/sherlockode-configuration-bundle)[digitalcloud/nova-address-field

A Laravel Nova Address field.

1019.5k](/packages/digitalcloud-nova-address-field)

PHPackages © 2026

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