A Laravel package for shortening URLs. Apart for creating short URLs - like bitly - it also supported updating URL redirects and tracking URL clicks.
Install the package
composer require arietimmerman/laravel-url-shortener
And start shortening URLs
(string)URLShortener::shorten("http://www.example.com");
Add the service provider in your config/app.php
.
'providers' => [
// [..]
\ArieTimmerman\Laravel\URLShortener\ServiceProvider::class
// [..]
];
Publish the configuration and the view.
php artisan vendor:publish --provider="ArieTimmerman\Laravel\URLShortener\ServiceProvider"
Optionally, register for URLVisit events in your EventServiceProvider
.
protected $listen = [
'ArieTimmerman\Laravel\URLShortener\Events\URLVisit' => [
'App\Listener\YourListener',
]
];
See config/urlshortener.php