URL shortening or squeezing package in Laravel.
You can easily install this package using Composer, by running the following command:
composer require media365/squeezer
This package has the following requirements:
- PHP 7.1 or higher
- Laravel 5.1 or higher
If you use Laravel 5.5 or higher, that's it. You can now use the package, continue to the usage section.
If you're using an older version of Laravel, register the package's service provider to your application. You can do
this by adding the following line to your config/app.php
file:
'providers' => [
...
Media365\Squeezer\SqueezerServiceProvider::class,
...
],
$shortener = app('url.shortener');
Once you have an instance of the shortener, you can shorten your URLs:
// This will return your shortened URL as a string
$shortener->shorten('https://github.com');
You can provide driver to shorten url
// This will return your shortened URL as a string with provided driver
$shortener->driver('is_gd')->shorten('https://github.com')