Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Rss Client Bundle Laravel Package

desarrolla2/rss-client-bundle

View on GitHub
Deep Wiki
Context7

RSSClientBundle

knpbundles.com

Latest Stable Version Total Downloads Build Status

Service for provide RSS client in your website, you can automatically add content to your site from your favorite information providers.

Bundle Installation

Get the bundle

Add to your /composer.json file :

    "require": {
        ...       
        "desarrolla2/rss-client-bundle": "2.*" 
    },

And make

composer update

Register the bundle

// app/AppKernel.php
<?php

  public function registerBundles()
  {
    return array(
      // ...
      new Desarrolla2\Bundle\RSSClientBundle\RSSClientBundle(),
      );
  }

Using RSS Bundle

Configure providers

You need edit your config.yml and add the rss routes you want to get.

# app/config/config.yml
rss_client:
   cache:
      ttl:     3600 # This is the default
   channels:     
      channel_name1:
         - 'http://www.osukaru.es/feed/'
         - 'http://desarrolla2.com/feed/'
         
      channel_name2:
         - 'http://feeds.feedburner.com/symfony/blog'
         - 'http://www.symfony.es/feed/'

The cache option is completely optional. If not specified the shown default take effect.

Optionally: configure custom processors

If you want to use custom processors to extract additional information from a feed, also add the "processors" key pointing to services that implement the ProcessorInterface.

rss_client:
   processors: ["my_service_id", "my_other_service_id"]

In your controller

Retrieve the service and fetch the content.

<?php

class NewsController extends Controller
{

    /**
     * Renders latest news
     *
     * @return array
     * @Route("/noticias", name="news_index")
     * @Template()
     */
    public function indexAction()
    {
        $this->client = $this->get('rss_client');

        return array(
            'feeds'   => $this->client->fetch('channel_name1'),
        );
    }

}

In your view

Render the content for your users

{% block content %}
    <section>
        {% for feed in feeds %}            
            <article>
                <header>
                    <a href="{{ feed.link }}" target="_blank">{{ feed.title }}</a>
                    <time>{{ feed.pubDate | date('d/m/Y H:i') }}</time>
                </header>
                <p>{{ feed | raw }}</p>
            </article>      
        {% else %}
            <p>Not news :(</p>
        {% endfor %}    
    </section>
{% endblock %}

Contact

You can contact with me on twitter.

More Info

See RSSClient.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed