Feed Read
This page is under active development. Now you can read one feed URL at once. We'll add multiple URLs feature soon.
You can easily read any RSS or Atom feed. There are two ways to read feed. You can read feed by creating our feed object or using facade class.
Using Feed Object
You need to create our Feed object like this:
use Obydul\EasyFeed\Feed;
$feed = new Feed();
$feed->url("http://example.com/rss.xml");
Using Facade
This is the way to read via Facade:
use Obydul\EasyFeed\Facades\FeedRead;
FeedRead::url("http://example.com/rss.xml");
Example
Here's a complete example:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Obydul\EasyFeed\Feed;
use Obydul\EasyFeed\Facades\FeedRead;
class FeedController extends Controller
{
// read feed by creating object
public function readUsingObject()
{
try {
$feed = new Feed();
$data = $feed->url("http://example.com/rss.xml");
dd($data);
} catch (\Exception $exception) {
dd($exception->getMessage());
}
}
// read feed using facade
public function readUsingFacade()
{
try {
$data = FeedRead::url("http://example.com/rss.xml");
dd($data);
} catch (\Exception $exception) {
dd($exception->getMessage());
}
}
}