The cutt.ly package for Laravel
As quick as possible you can install this package via composer
Run this command:
composer require technoyer/laravel-cuttly
Register the service provider in config/app.php
'providers' => [
// [...]
//Cuttly
Technoyer\Cuttly\CuttlyServiceProvider::class,
],
You may also register the Cuttly
facade:
'aliases' => [
// [...]
//Cuttly
'Cuttly' => Technoyer\Cuttly\Facade\Cuttly::class,
],
You must add the cutt.ly api key in .evn file, and publishing the config/cuttly.php
php artisan vendor:publish --provider="Technoyer\Cuttly\CuttlyServiceProvider"
Add this line in .env file
CUTTLY_API_KEY=your cutt.ly api key
Get your api key for this link: https://cutt.ly/edit
<?php
$url = app('cuttly')->short('https://www.google.com/example');
//output e.g: https://cutt.ly/FUMWlUC
Or using facade with namespace declaration like this:
<?php
$url = Cuttly::short('https://www.google.com/example');
//output e.g: https://cutt.ly/FUMWlUC