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.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay