exileed / inoreader-api
Inoreader.com API 客户端
1.0.0
2020-11-23 17:33 UTC
Requires
- php: ^7.3 || ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^6.0 | ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ~3.5
This package is auto-updated.
Last update: 2024-09-10 09:42:53 UTC
README
使用 OAuth 进行身份验证并消费 Inoreader API 的 PHP 客户端。
安装
通过 Composer
$ composer require exileed/inoreader-api
用法
客户端示例
use ExileeD\Inoreader\Inoreader; $apiKey = 1000000; $apiSecret = 'xxxx'; $token = 'ssss'; $inoreaderClient = new Inoreader( $apiKey, $apiSecret ); $inoreaderClient->setAccessToken($token); $inoreaderClient->itemsIds();
通过 OAuth2 获取访问令牌
use ExileeD\Inoreader\Inoreader; $apiKey = 1000000; $apiSecret = 'xxxx'; $client = new Inoreader( $apiKey, $apiSecret ); $redirectUrl = 'https://'; $scope = 'test'; $client->getLoginUrl($redirectUrl, $scope); $client->accessTokenFromCode('code', $redirectUrl); // Access token from refresh token $client->accessTokenFromCode('code', $redirectUrl);
高级用法
用户信息
$client->userInfo();
添加订阅
$url = 'https://www.inoreader.com/blog/feed'; $client->addSubscription($url);
编辑订阅
$url = 'feed/https://www.inoreader.com/blog/feed'; $client->editSubscription(['ac' => 'edit', 's' => $url, 't' => 'test']));
未读数量
$client->unreadCount():
订阅列表
$client->subscriptionList();
文件夹和标签列表
use ExileeD\Inoreader\Objects\Tag; $type = Tag::TYPE_ITEM; //$type = Tag::TYPE_TAG; //$type = Tag::TYPE_FOLDER; //$type = Tag::TYPE_ACTIVE_SEARCH; $client->tagsList($type, $count);
测试
$ ./vendor/bin/phpunit
贡献
请参阅 CONTRIBUTING 获取详细信息。
致谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。