gallib/laravel-short-url

A Laravel package to shorten urls
17,593 164
Install
composer require gallib/laravel-short-url
Latest Version:1.9.0
PHP:^8.0
License:MIT
Last Updated:Feb 1, 2023
Links: GitHub  ·  Packagist
Maintainer: Gallib

Laravel Short Url Build Status StyleCI

Laravel Short Url is a package allowing you to shorten urls.

Installation

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

Configuration

Laravel Short Url configuration file can be found on config/shorturl.php

  • blacklist : Allows to blacklist urls. Keywords can be either an url, a keyword or an extension

Advanced configuration

Instead of adding ShortUrl::routes(); you can call three separates methods:

  • ShortUrl::createRoutes(); to shorten urls
  • ShortUrl::manageRoutes(); to manage urls
  • ShortUrl::redirectRoute(); to redirect to the url

this allows you to add middlewares or prefix routes.

Migration Customization

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

Nice!

Laravel short url is now set up on your homepage.

Credits

Related Packages

mbarwick83/shorty

Google Url Shortener API Package for Laravel 5.1

204,507 31
waavi/url-shortener

Url Shortener for Laravel 5 with support for Google and Bitly drivers.

178,037 62
shivella/laravel-bitly

Laravel package for generating bitly url

933,441 74
jgrossi/petty

A very simple URL shortener using custom domains

63 7