Short links are no longer just a way to reduce the length of a URL.

Today, they are widely used for marketing, analytics, automation, and integration with custom applications.

If you're building a service, CRM, dashboard, email campaign, or internal tool, creating short links programmatically is far more convenient than doing it manually.

Lix.li provides an official PHP SDK that makes it easy to create short links directly from PHP code, assign custom aliases, add UTM parameters, tags, and other useful options.

In this article, you'll learn how to create a short link using the Lix.li PHP SDK and explore the most common usage scenarios.


What Is the Lix.li PHP SDK?

The Lix.li PHP SDK is the official library for working with the platform's REST API.

It eliminates the need to manually build HTTP requests, serialize JSON, and parse API responses.

The SDK provides a clean object-oriented interface, making integration much faster and easier.

The source code is available on GitHub: https://github.com/lix-url/php-sdk You can learn more about the SDK on the official product page.


Installation

Install the library using Composer.

composer require lix-url/php-sdk

Once installed, simply create a client instance and start working with the API.


The simplest use case is shortening a single URL.

// Create a basic link
$result = $client->links()->create(
    'https://example.com'
);

The SDK automatically sends the request to the Lix.li API and returns an object containing information about the newly created short link.


In many situations, you need more than just a shortened URL—you want a link that's ready for a marketing campaign. The PHP SDK allows you to do this with a single method call.

$result = $client->links()->create(
    url: 'https://example.com',
    alias: 'summer-sale',
    utm: [
        'utm_source' => 'newsletter',
        'utm_medium' => 'email',
        'utm_campaign' => 'summer-sale',
    ],
    title: 'Marketing link',
    tags: ['marketing', '2026'],
    isPublic: true
);

This example uses several optional parameters.

Parameter Description
url The original URL
alias Custom short link alias
utm UTM tracking parameters
tags Link tags
title Link title
isPublic Whether the link is public
This approach is ideal for email campaigns, marketing automation, social media publishing, and automatically generated links.

Keep in mind that some features, such as custom aliases, are available only with paid plans: https://lix.li/prices


Which Parameters Does the create() Method Support?

The link creation method supports many additional parameters.

public function create(
    string  $url,
    ?string $alias = null,
    ?string $title = null,
    ?int    $groupId = null,
    array   $tags = [],
    array   $meta = [],
    array   $utm = [],
    array   $trackingPixelIds = [],
    ?string $activeBeforeDatetime = null,
    ?string $password = null,
    bool    $isPublic = true,
): LinkShortenResult

The most commonly used parameters include:

Parameter Description
url URL to shorten
alias Custom short URL
title Link title
groupId Link group
tags Link tags
meta Additional metadata
utm UTM parameters
trackingPixelIds Tracking Pixels integration
activeBeforeDatetime Link expiration date
password Password protection
isPublic Makes the link public or private
Even if all you need today is basic URL shortening, the SDK is already designed to support much more advanced workflows.

What Does the Method Return?

The method returns a LinkShortenResult object. It contains information such as:

  • the created short link;
  • the link identifier;
  • the original URL;
  • API usage limits;
  • the number of requests already used;
  • the number of remaining requests. This makes it easy to display the result to users or continue processing it within your application.

When Should You Use the PHP SDK?

The official SDK is especially useful if you need to:

  • automatically create short links;
  • generate links for products or blog posts;
  • add UTM tracking parameters;
  • integrate URL shortening into a CRM;
  • connect it to a CMS;
  • work with SaaS platforms;
  • generate links inside internal business applications;
  • automate marketing workflows. For most PHP projects, using the SDK is much more convenient than sending raw HTTP requests.

PHP SDK or REST API?

Both the PHP SDK and the REST API provide access to the same platform features. However, the SDK offers several advantages:

  • less boilerplate code;
  • automatic data serialization;
  • object-oriented responses;
  • cleaner and more readable code;
  • easier maintenance;
  • faster development. For PHP applications, the official SDK is the recommended approach.


Conclusion

The Lix.li PHP SDK lets you start creating short links in just a few minutes. Simply install the library with Composer, create a client instance, and call the links()->create() method. Whenever needed, you can take advantage of additional platform features such as custom aliases, UTM parameters, groups, tags, Tracking Pixels, link expiration, and much more. If you're building a PHP application and want to integrate URL shortening without manually working with HTTP requests, the official Lix.li PHP SDK is a reliable and developer-friendly solution.