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
- API Documentation: https://lix.li/api
- OpenAPI Specification: https://github.com/lix-url/openapi
Other SDKs
- Go SDK: https://github.com/lix-url/go-sdk
- JavaScript SDK: https://github.com/lix-url/js-sdk
- Python SDK: https://github.com/lix-url/python-sdk
Support
Need help with the API or SDK?
- Support Center: https://lix.li/support
License
MIT
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-08