PHP code example of tly / laravel-url-shortener-api
1. Go to this page and download the library: Download tly/laravel-url-shortener-api 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/ */
tly / laravel-url-shortener-api example snippets
use TLY\LaravelUrlShortener\Facades\TLYApi;
$created = TLYApi::create([
'long_url' => 'https://example.com',
'description' => 'Example Link',
]);
$stats = TLYApi::stats('https://t.ly/abc1', [
'start_date' => '2025-08-01T00:00:00Z',
'end_date' => '2025-08-31T23:59:59Z',
]);
$expanded = TLYApi::expand('https://t.ly/OYXL', 'password123');
$links = TLYApi::listShortLinks([
'search' => 'amazon',
'tag_ids' => [1, 2, 3],
'pixel_ids' => [1, 2, 3],
]);
$oneLinkStats = TLYApi::oneLinkStats(
'https://t.ly/one',
'2024-06-01',
'2024-06-08'
);
$oneLinks = TLYApi::listOneLinks(['page' => 1]);
$preset = TLYApi::createUtmPreset([
'name' => 'Newsletter Launch',
'source' => 'newsletter',
'medium' => 'email',
'campaign' => 'fall_launch',
]);
$pixel = TLYApi::createPixel([
'name' => 'GTMPixel',
'pixel_id' => 'GTM-xxxx',
'pixel_type' => 'googleTagManager',
]);
$qr = TLYApi::getQrCode('https://t.ly/c55j', [
'output' => 'base64',
'format' => 'eps',
]);
$tag = TLYApi::createTag(['tag' => 'fall2026']);
bash
php artisan vendor:publish --provider="TLY\\LaravelUrlShortener\\TLYServiceProvider" --tag=config