PHP code example of kerodev / short-link
1. Go to this page and download the library: Download kerodev/short-link library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kerodev / short-link example snippets
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;
php
// add token inside env.php
SHORTEN_TOKEN=""
SHORTEN_URL="https://api-ssl.bitly.com/v4/shorten"