Introducing the T.LY Laravel URL Shortener API Package

Introducing the T.LY Laravel URL Shortener API Package

When building web applications, it’s often necessary to provide users with shortened links—be it for social sharing, measuring clicks, or simply tidying up long URLs. The T.LY API makes it simple and fast to generate short, trackable URLs. Thanks to the new TLY Laravel package, integrating this functionality into your PHP Laravel project is now easier than ever.

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.

Integrating all this functionality into your Laravel application can give your users a much more polished experience. With the tly/laravel-url-shortener-api package, it’s a breeze.

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


use TLY\LaravelUrlShortener\Facades\TLYApi;

$response = TLYApi::create([
    'long_url' => 'https://example.com',
    'description' => 'Example 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',
]);
use TLY\LaravelUrlShortener\Facades\TLYApi;
$response = TLYApi::delete('https://t.ly/123');
use TLY\LaravelUrlShortener\Facades\TLYApi;
$response = TLYApi::get('https://t.ly/123');
use TLY\LaravelUrlShortener\Facades\TLYApi;
$response = TLYApi::stats('https://t.ly/123');

Thanks to the TLY Laravel URL Shortener API package, you can seamlessly integrate powerful URL shortening and analytics features into your Laravel application. Whether you need quick, branded short links, detailed statistics, or tagging capabilities, the T.LY API has you covered.

For more details, visit the T.LY documentation and start exploring all the features available at your fingertips.


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. In 2019, 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.

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 and QR codes. 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.