定制 lix-url/php-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lix-url/php-sdk

最新稳定版本:0.1.1

Composer 安装命令:

composer require lix-url/php-sdk

包简介

Official PHP SDK for the Lix.li API.

README 文档

README

Official PHP SDK for the Lix.li API.

Lix.li is a URL shortening and link analytics platform with support for custom aliases, groups, tags, UTM parameters and detailed click tracking.

Requirements

  • PHP 8.2+
  • Composer

Installation

composer require lix-url/php-sdk

Quick Start

use Lix\Client;

$client = new Client('lix_live_xxx');
$link = $client->links()->create('https://example.com');
echo $link->link->shortUrl;

Profile

Get information about the authenticated account.

$profile = $client->profile()->get();

echo $profile->user->email;

Links

Create a Link

$link = $client->links()->create(
    url: 'https://example.com'
);

echo $link->link->shortUrl;

Create a Link with Custom Alias

$link = $client->links()->create(
    url: 'https://example.com',
    alias: 'my-link'
);

Create a Link with UTM Parameters

$link = $client->links()->create(
    url: 'https://example.com',
    utm: [
        'source' => 'newsletter',
        'medium' => 'email',
        'campaign' => 'summer-sale',
    ]
);

Get a Link

$link = $client->links()->get(123);

echo $link->url;
echo $link->shortUrl;

Update a Link

$link = $client->links()->update(
    id: 123,
    title: 'Updated title'
);

Delete a Link

$client->links()->delete(123);

List Links

$linksResponse = $client->links()->list();

foreach ($linksResponse->links as $link) {
    echo $link->shortUrl . PHP_EOL;
}

Pagination

$links = $client->links()->list(
    limit: 100,
    fromId: 500
);

Groups

Create a Group

$group = $client->groups()->create(
    name: 'Marketing'
);

echo $group->name;

Create a Rotating Group

$group = $client->groups()->create(
    name: 'Landing Pages',
    isRotate: true
);

Get a Group

$group = $client->groups()->get(10);

Update a Group

$group = $client->groups()->update(
    groupId: 10,
    description: 'Updated description'
);

Delete a Group

$client->groups()->delete(10);

List Groups

$response = $client->groups()->list(limit: 10, fromId: 1000);

foreach ($response->groups as $group) {
    echo $group->name . PHP_EOL;
}

Error Handling

use Lix\Exceptions\UnauthorizedException;
use Lix\Exceptions\ValidationException;

try {
    $client->links()->create(
        url: 'invalid-url'
    );
} catch (ValidationException $e) {
    // Validation failed
    
    // Validation error fields data
    var_dump($e->data);
} catch (UnauthorizedException $e) {
    // Invalid API key
}

Documentation

Other SDKs

Support

Need help with the API or SDK?

License

MIT

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固