PHP wrapper around Feedly's REST API
PHP
Latest commit ef07345 Jul 4, 2016 @kbariotis committed on GitHub Merge pull request #25 from chinib/patch-1
Add Subscriptions to model

README.md

NOTICE You can find the first edition of my code here dev

feedly-api

PHP wrapper around Feedly's REST API.

Under Construction! Not every API's functionality implemented yet.

Build Status

Notes

Check the examples before anything.

If you are working in Sandbox mode of Feedly's API you should know a couple of things.

  • Your Client's ID, secret must taken from here, which is updated very often so be sure to check it once in while.
  • While in Sandbox mode, only "http://localhost" is permited for callback url. So leave it as is and just replace it every time with your domain, if it's different. You can also add you own to permitted domains here.
  • Once you've done developing you can contact Feedly and ask them to put you on production.

Installation

Add this to your composer.json

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

Or download the ZIP.

Documentation

Constructor:

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

The Mode determines if you want to use the Sandbox mode (SandBoxMode class) or standard one (DeveloperMode class).

The AccessTokenStorage determines where the information about token should be stored. In example in session, file or database.

***Sandbox Example

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

***Standard Mode Example

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

Authentication:

Check the example.

Note that not every Feedly action needs authentication. Passing a token is optional.

Endpoints

Profile:


    $profile = $feedly->profile();

    var_dump($profile->fetch());

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

    $profile->persist();

Categories:


    $categories = $feedly->categories();

    var_dump($categories->fetch());

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

    $categories->delete($id);

Entries:


    $entries = $feedly->entries();

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

Streams:


    $streams = $feedly->streams();

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

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

Markers:


    $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'
    ));

Contribute

  • Create a branch
  • Add your models here
  • Run tests with phpunit
  • Make a Pull Request

Licence

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.