DEV Community

Cover image for [Package] Simpler Url Shortener for Laravel
Marc Garcia Torrent
Marc Garcia Torrent

Posted on • Originally published at devdojo.com

[Package] Simpler Url Shortener for Laravel

Hello! Marc here.

I've just released a new laravel package. It's very simple, but hope it will help you in some projects.

Thank you! All PRs and suggestions will be welcome!

https://github.com/magarrent/laravel-url-shortener

Laravel Url Shortener

Laravel Url Shortener

Software License
Package Size

Install

composer require magarrent/laravel-url-shortener

Usage

Import the UrlShortener in your php file.

use Magarrent\LaravelUrlShortener\Models\UrlShortener;
Enter fullscreen mode Exit fullscreen mode

Then you can use the Url shortener package to redirect internal and external links.

UrlShortener::generateShortUrl("https://www.kodio.tech")

UrlShortener::generateShortUrl("/my-next/local/page")
Enter fullscreen mode Exit fullscreen mode

Ex. Redirection:

https://your.url/H8g9Jx => https://www.kodio.tech


You only have to send the Url To param to the UrlShortener model:

public  static  function  generateShortUrl(String $toUrl):  String
Enter fullscreen mode Exit fullscreen mode




Roadmap

  • Add custom configuration for url key characters (Currently 6)

Changelog

1.0 - First version

Contributing

Please see CONTRIBUTING for details.

Credits

Security

If you discover any security-related issues, please email magarrent@gmail.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

Top comments (0)