This package allows you to process shorten links with Cutt.ly from your Laravel application.
composer require parsadanashvili/laravel-cuttly
If you're using Laravel 5.4 or lower, you have to manually add a service provider in your config/app.php
file.
Open config/app.php
and add CuttlyServiceProvider
to the providers
array.
'providers' => [
# Other providers
Parsadanashvili\LaravelCuttly\CuttlyServiceProvider::class,
],
Publish migrations and config by running:
php artisan vendor:publish --provider="Parsadanashvili\LaravelCuttly\CuttlyServiceProvider"
Place api key to .env file:
CUTTLY_API_KEY=CuttlyApiKey
To shorten url you should use Shorten Url function
Parameters:
url
-string
, required
Return: https://cutt.ly/mFtHxpP
use Parsadanashvili\LaravelCuttly\Requests\ShortenUrl;
return ShortenUrl::request('https://google.com')
->name('Name') //optional
->useDomain() //optional
->process();