1. Go to this page and download the library: Download marjose/url-shortener 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/ */
marjose / url-shortener example snippets
return [
'length' => 6, // Length of the string for shortening the URL
'expiration' => 120, // minutes, 0 for no expiration
];
use Marjose\UrlShortener\Facades\UrlShortener;
$response = UrlShortener::url('https://xxxx.xx/xxxx')->generate();
use Marjose\UrlShortener\Facades\UrlShortener;
$response = UrlShortener::url('https://xxxx.xx/xxxx')->setExpiration(15)->generate();
use Marjose\UrlShortener\Facades\UrlShortener;
$response = UrlShortener::url('https://xxxx.xx/xxxx')->setLength(5)->setExpiration(15)->generate();
use Marjose\UrlShortener\Facades\UrlShortener;
$response = UrlShortener::url('https://xxxx.xx/xxxx')->isExpired();
// This will return boolean or an exception if the supplied url is not found in the database