php-feed-io/feed-io
feed-io is a PHP library for reading and writing RSS and Atom feeds. It handles fetching, parsing, and generating feed content with an easy-to-use API, making it simpler to consume external feeds or publish your own in PHP applications.
Illuminate\Http\Client) can be wrapped to meet PSR-18 requirements, ensuring seamless integration.composer require php-feed-io/feed-io) and minimal dependencies (PSR-18 client, PSR-3 logger) reduce integration overhead.Http facade or a custom PSR-18 adapter.\Log::channel()) by injecting a PSR-3 logger (e.g., Monolog).Response class for PSR-7 responses (via feedIo->getPsrResponse()).Filter\Chain system can integrate with Eloquent models (e.g., filtering items against a published_at column).Http client may need minor adjustments for PSR-18 compliance (e.g., handling redirects or custom headers).Cache facade) or queue jobs (feedIo CLI via Artisan commands).FeedItem with title, published_at, url)?Http facade with a PSR-18 adapter (e.g., php-http/laravel-adapter).Log facade (PSR-3 compliant) into FeedIo.FeedIo responses to Laravel Response objects using feedIo->getPsrResponse().FeedProcessorJob).last_updated_at, next_update) in a feeds table.FeedItem with feed_id, title, content).Cache::remember('feed:php.net', 3600, fn() => $feedIo->read(...))).feedIo->getNextUpdate() to schedule cache invalidation.feed-io to fetch and parse external feeds (e.g., in a FeedService).use FeedIo\FeedIo;
use Illuminate\Support\Facades\Http;
$client = new \FeedIo\Adapter\Http\Client(Http::client());
$feedIo = new FeedIo($client, \Log::channel('feed'));
$result = $feedIo->read('https://example.com/feed.atom');
$items = $result->getItemsSince(now()->subDays(1));
/feed endpoint).feedIo->getPsrResponse() to generate Atom/RSS/JSONFeed responses.Route::get('/feed', function () {
$feed = new \FeedIo\Feed();
$feed->setTitle('My Blog');
$feed->addItem((new \FeedIo\Feed\Item())->setTitle('New Post'));
return response($feedIo->getPsrResponse($feed, 'atom'));
});
php artisan schedule:run)../vendor/bin/feedio) in Artisan commands or queues.feed-io v6.x (PHP 8.1+).feed-io v5.x (PHP 8.0+).guzzlehttp/guzzle or symfony/http-client is installed if using their adapters.monolog/monolog is suggested but not required (Laravel’s Log works).Http client is PSR-18 compatible (via php-http/laravel-adapter).Log facade is PSR-3 compliant.FeedService class to encapsulate FeedIo logic.Http::fake()).FeedIoTestCase or Laravel’s HttpTestResponse.feed-io for breaking changes (e.g., PHP 8.5 support in v6.3.0).FeedIo logs in Laravel’s logs/feed.log (configure via logging.php).Factory) were removed in v6.0; migrate early.try-catch with FeedIo\Exception\FeedException.feedIo->getDateTimeBuilder()->setFeedTimezone().Http client middleware (e.g., retries, timeouts)../vendor/bin/feedio read <url> for manual testing.$feedIo->read(...) results interactively.feed-io; Laravel forums for integration help.FeedProcessorJob).feedIo by:
Http::timeout(30)).How can I help you explore Laravel packages today?