ejdelmonico/laravel-rss-feed

A simple Laravel 5 wrapper around SimplePie to pull in RSS feeds

v1.0.4 2016-11-21 00:33 UTC

This package is auto-updated.

Last update: 2024-10-27 04:02:44 UTC


README

Latest Version on Packagist Software License Build Status Quality Score StyleCI Status Total Downloads

This project is crafted for usage in Laravel 5 applications using >= PHP 7. It was inspired by a need to pull in blog posts from a single url to use in Laravel Blade templates.

Installation

The LaravelRSSFeed package is installed by requiring the package in your composer.json. You can either do it via composer install

composer require ejdelmonico/laravel-rss-feed

or by simply including it.

{
  "require": {
    "ejdelmonico/laravel-rss-feed": "1.*"
  }
}

Configuration

To use the package, you must register the service provider:

// In config/app.php

'providers' => [
  // ...
  ejdelmonico\LaravelRSSFeed\LaravelRSSFeedServiceProvider::class,
],

'aliases' => [
  // ...
  'Feed' => ejdelmonico\LaravelRSSFeed\FeedFacade::class,
],

Usage

php artisan vendor:publish --provider="ejdelmonico\LaravelRSSFeed\LaravelRSSFeedServiceProvider" --tag=config

Here is a simple example:

Route::get('feed', function () {
    $url = 'https://blog.errordetective.com/rss/';
    $rss = Feed::makeRequest($url);
    $data = array(
        'title' => $rss->feed->get_title(),
        'permalink' => $rss->feed->get_permalink(),
        'items' => $rss->feed->get_items(),
    );
    return view('pages.feed', $data);
});

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email ejdelmonico@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.