Introducing the T.LY Laravel URL Shortener API Package

Introducing the T.LY Laravel URL Shortener API Package

If you need short links inside a Laravel app, the T.LY API already gives you the building blocks. The TLY Laravel package makes that workflow feel more native, so you can create, update, and inspect links without wiring up every request yourself.

T.LY API Docs on the t.ly domain showing the authenticated API reference used by Laravel integrations.

Why Use the T.LY API for URL Shortening?

T.LY is a simple URL shortener that goes beyond just shrinking links. By leveraging the T.LY API, you can:

  • Generate short URLs with ease.
  • Access analytics and click metrics.
  • Organize and manage your shortened URLs through tags and dashboards.
  • Maintain brand consistency by using custom domains.

If you want those features inside a Laravel app, the tly/laravel-url-shortener-api package keeps the integration simple.

Getting Started


Create an API Key

  1. Register a T.LY Account
  2. Create an API Token

Installation

Install via Composer:

composer require tly/laravel-url-shortener-api

Publish the configuration:

php artisan vendor:publish --provider="TLY\\LaravelUrlShortener\\TLYServiceProvider" --tag=config

Set your API token in .env:

TLY_API_TOKEN=your_api_token_here

Examples


Create a Short Link

use TLY\LaravelUrlShortener\Facades\TLYApi;

$response = TLYApi::create([
    'long_url' => 'https://example.com',
    'description' => 'Example Link',
]);

Update a Short Link

use TLY\LaravelUrlShortener\Facades\TLYApi;

$response = TLYApi::update([
    'short_url' => 'https://t.ly/123',
    'long_url' => 'https://new-destination.com',
    'description' => 'Updated Link Description',
    'expire_at_datetime' => '2035-12-31 23:59:59',
]);

Delete a Short Link

use TLY\LaravelUrlShortener\Facades\TLYApi;
$response = TLYApi::delete('https://t.ly/123');

Get a Short Link

use TLY\LaravelUrlShortener\Facades\TLYApi;
$response = TLYApi::get('https://t.ly/123');

Get the stats for a Short Link

use TLY\LaravelUrlShortener\Facades\TLYApi;
$response = TLYApi::stats('https://t.ly/123');

The TLY Laravel URL Shortener API package gives Laravel apps a clean way to work with T.LY. If you need branded short links, stats, or tags, it saves you from rebuilding the same plumbing by hand.

For more details, visit the T.LY documentation.


Author Tim Leland

Tim Leland

Tim Leland brings over 20 years of software development experience to the table, creating products used by millions around the globe. He founded T.LY with a vision to build the world’s shortest URL shortener—and since then, the platform’s popularity has soared. Under Tim’s leadership, T.LY has evolved into a top-tier solution recognized for its reliability and ease of use, now serving millions of satisfied users worldwide.

Editorial Policy

Ready to improve how you manage links?

T.LY URL Shortener makes long links look cleaner and easier to share! Add your own Custom Domains to personalize your brand. Create Smart Links to customize a URL's destination. Generate QR codes to promote your business.

Sign Up for Free
About T.LY
T.LY is the best link management service to track, brand, and share short URLs, QR codes, and OneLinks. Install our free Browser Extension with over 450,000 users from the extension store to automatically shorten links in one easy click! We support Chrome, Firefox, Edge and Opera.