kbariotis/feedly-api

Feedly REST API 的 PHP 封装

1.1 2014-10-14 19:30 UTC

This package is not auto-updated.

Last update: 2024-09-24 02:18:48 UTC


README

PHP 封装 Feedly REST API

Build Status

备注

在开始之前,先检查 示例

如果你在使用 Feedly API 的沙盒模式,你应该知道一些事情。

  • 你的客户端 ID 和密钥必须从 这里 获取,这个信息更新非常频繁,所以请时不时地检查一下。
  • 在沙盒模式下,只有 "https://" 被允许作为回调 URL。所以保持原样,每次只需将其替换为你的域名即可,如果它不同。你还可以在这里添加自己的域名
  • 一旦开发完成,你可以联系 Feedly 并请求他们把你放在 生产环境

安装

将此添加到你的 composer.json 中

"require": {
        "kbariotis/feedly-api": "dev-master"
    }

或者下载 ZIP

文档

构造函数

$feedly = new Feedly(Mode $mode, AccessTokenStorage $accessTokenStorage);

Mode 决定你是否想使用沙盒模式(SandBoxMode 类)还是标准模式(DeveloperMode 类)。

AccessTokenStorage 决定了令牌信息应该存储在哪里。例如在会话、文件或数据库中。

***沙盒模式示例

$feedly = new Feedly(new feedly\Mode\SandBoxMode(), new feedly\AccessTokenStorage\AccessTokenSessionStorage());

***标准模式示例

$feedly = new Feedly(new feedly\Mode\DeveloperMode(), new feedly\AccessTokenStorage\AccessTokenSessionStorage());

身份验证

检查 示例

请注意,并非每个 Feedly 操作都需要身份验证。传递令牌是可选的。

端点

个人资料

    $profile = $feedly->profile();

    var_dump($profile->fetch());

    $profile->setOptions(array(
        'email'=>'odysseus@ithaca.gr'
    ));

    $profile->persist();

分类

    $categories = $feedly->categories();

    var_dump($categories->fetch());

    $categories->changeLabel($id, 'New Label');

    $categories->delete($id);

条目

    $entries = $feedly->entries();

    var_dump($entries->get($id));

    $streams = $feedly->streams();
    
    //Retrieve ids from stream 
    var_dump($stream->get($id,"ids"));
    
    //Retrieve contents from stream 
    var_dump($stream->get($id,"contents"));

标记

    $markers = $feedly->markers();

    var_dump($markers->get($id));

    var_dump($markers->getUnreadCount());

    $markers->markArticleAsRead(array(
        'TSxGHgRh4oAiHxRU9TgPrpYvYVBPjipkmUVSHGYCTY0=_14499073085:c034:d32dab1f',
        'TSxGHgRh4oAiHxRU9TgPrpYvYVBPjipkmUVSHGYCTY0=_1449255d60a:22c3491:9c6d71ab'
    ));

    $markers->markArticleAsUnread(array(
        'TSxGHgRh4oAiHxRU9TgPrpYvYVBPjipkmUVSHGYCTY0=_14499073085:c034:d32dab1f',
        'TSxGHgRh4oAiHxRU9TgPrpYvYVBPjipkmUVSHGYCTY0=_1449255d60a:22c3491:9c6d71ab'
    ));

    $markers->markFeedAsUnread(array(
        'feed/http://feeds.feedburner.com/design-milk'
    ));

    $markers->markFeedAsUnread(array(
        'user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/design',
        'user/c805fcbf-3acf-4302-a97e-d82f9d7c897f/category/photography'
    ));

贡献

  • 创建分支
  • 在此处添加你的模型 这里
  • 使用 phpunit 运行测试
  • 发起 Pull Request

许可

The MIT License (MIT)

Copyright (c) 2014 Konstantinos Bariotis

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.