pouler / linkfire-api
Linkfire API 的 PHP 包
1.0
2022-07-25 12:05 UTC
Requires
- php: >=8.1
- ext-json: *
- symfony/http-client: ^5.4|^6.0
- symfony/property-access: ^5.4|^6.0
- symfony/serializer: ^5.4|^6.0
Requires (Dev)
- phpunit/phpunit: ^9
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-09-25 17:03:30 UTC
README
这是一个 Linkfire API 的 PHP 封装器。
要求
- PHP >=8.1
安装
使用 Composer 安装
composer require pouler/linkfire-api
使用示例
<?php declare(strict_types=1); use PouleR\LinkfireAPI\Entity\CampaignLink; use PouleR\LinkfireAPI\LinkfireAPI; use PouleR\LinkfireAPI\LinkfireAPIClient; use Symfony\Component\HttpClient\CurlHttpClient; require 'vendor/autoload.php'; $httpClient = new CurlHttpClient(); $apiClient = new LinkfireAPIClient($httpClient); $linkfireAPI = new LinkfireAPI($apiClient); $authenticatedToken = $linkfireAPI->authenticate('client-id', 'client-secret'); $linkfireAPI->setAccessToken($authenticatedToken->getAccessToken()); // Retrieve all mediaServices for a given board $mediaServices = $linkfireAPI->getBoardMediaServices('board-id'); // Create a campaign link $campaignLink = $api->createCampaignLink('board-id', [ 'title' => 'Readme', 'baseUrl' => 'https://open.spotify.com/album/your-album-uri', 'domainId' => 'domain-id', 'artist' => 'PouleR', 'album' => 'Readme', 'mediaType' => 'Music', ]);