GithubHelp home page GithubHelp logo

vinaocruz / rssclient Goto Github PK

View Code? Open in Web Editor NEW

This project forked from desarrolla2/rssclient

0.0 2.0 0.0 400 KB

Service for provide RSS client in your website

License: MIT License

PHP 100.00%

rssclient's Introduction

RSSClient

Build Status

RSSClient is a simple to use RSS library to fetch and use RSS feeds. RSSClient is very fast!

You can read the RSS specification on RFC

RSSClient Support Atom1.0 now.

Installation

With Composer

It is best installed it through packagist by including desarrolla2/rss-client in your project composer.json require:

    "require": {
        // ...
        "desarrolla2/rss-client":  "dev-master"
    }

Without Composer

You can also download it from [Github] (https://github.com/desarrolla2/RSSClient), but no autoloader is provided so you'll need to register it with your own PSR-0 compatible autoloader.

Usage

Without Cache

This example does not use any cache, so it probably will be too slow to be used on a website, you should implement your system cache, or use the cache system described below

    <?php

    use Desarrolla2\RSSClient\RSSClient;

    $client = new RSSClient();

    $client->addFeeds(array(
            'http://news.ycombinator.com/rss',
            'http://feeds.feedburner.com/TechCrunch/',
                ), 'news'
        );

    $feeds = $client->fetch('news');

With Cache

This example uses the cache implemented by Seller desarrolla2/cache you must select the adapter depending on your needs, you can find all the info in the repository [Github] (https://github.com/desarrolla2/Cache).

    <?php

    use Desarrolla2\RSSClient\Cache\RSSClient;
    use Desarrolla2\Cache\Cache;
    use Desarrolla2\Cache\Adapter\File;

    // It is important that you select and configure your cache adapter
    $client = new RSSClient());
    $client->setCache(new Cache(new File('/tmp')));

You can see how to configure desarrolla2/cache in its [README] (https://github.com/desarrolla2/Cache)

The rest of the procedure is exactly the same as if you were using the client without cache.

    <?php
    
    $client->addFeeds(array(
        'http://news.ycombinator.com/rss',
        'http://feeds.feedburner.com/TechCrunch/',
        ), 'news'
    ));

    $feeds = $client->fetch('news');

Formats

  • RSS20
  • Atom10

Code Coverage

Do you want to see RSSClient Code Coverage see here

Contact

You can contact with me on twitter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.