Creando un acortador de URLs en Laravel desde 0.
https://github.com/magarrent/laravel-url-shortener
馃憤 Dale like al v铆deo y subscribete al canal para estar al d铆a de nuevos v铆deos.
馃挵 Ayuda al canal con nuestro Patreon oficial 馃挵
https://www.patreon.com/magarrent
—— GitHub ——
Laravel Url Shortener
Install
composer require magarrent/laravel-url-shortener
Run migrations:
php artisan migrate
Configuration
If you want to configurate some package parameters, run vendor publish:
php artisan vendor:publish --provider="Magarrent\LaravelUrlShortener\LaravelUrlShortenerServiceProvider"
Usage
Import the UrlShortener in your php file.
use Magarrent\LaravelUrlShortener\Models\UrlShortener;
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")
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
Roadmap
- Ask me for more features! You can buy me a coffe too 馃檪
Changelog
1.0.2
- Add聽
getOriginalUrlFromKey
聽function to model - Added configuration for Url key length
1.0 – First version
Contributing
Please see聽CONTRIBUTING聽for details.
Credits
Security
If you discover any security-related issues, please email聽[email protected]聽instead of using the issue tracker.
License
The MIT License (MIT). Please see聽License File聽for more information.