Stars: 161
Forks: 39
Pull Requests: 22
Issues: 8
Watchers: 6
Last Updated: 2023-02-01 23:44:11
A Laravel package to shorten urls
License: MIT License
Languages: PHP, Blade
Laravel Short Url is a package allowing you to shorten urls.
With composer
composer require gallib/laravel-short-url
then run
php artisan vendor:publish --provider="Gallib\ShortUrl\ShortUrlServiceProvider"
php artisan migrate
finally, paste ShortUrl::routes(); at the end of routes/web.php
Laravel Short Url configuration file can be found on config/shorturl.php
Instead of adding ShortUrl::routes(); you can call three separates methods:
ShortUrl::createRoutes(); to shorten urlsShortUrl::manageRoutes(); to manage urlsShortUrl::redirectRoute(); to redirect to the urlthis allows you to add middlewares or prefix routes.
If you are not going to use Short Url's default migrations, you should call the
ShortUrl::ignoreMigrations(); method in the register method of your AppServiceProvider.
You may export the default migrations using
php artisan vendor:publish --tag=shorturl-migrations
Laravel short url is now set up on your homepage.