Install the package through Composer.
composer require kerodev/short-link
Required configuration file (.env) file
// add token inside env.php
SHORTEN_TOKEN=""
SHORTEN_URL="https://api-ssl.bitly.com/v4/shorten"
Optional configuration file (useful if you plan to have full control)
php artisan vendor:publish --tag="shortconfig"
// In your controller
// Use The Helper class Bitly to shorten urls
use Shorter;
return Shorter::shorten('https://www.youtube.com');
// get link only
$short = Shorter::shorten('https://www.youtube.com');
return $short->link;
The Http Client Package is open-sourced software licensed under the MIT license