-
Notifications
You must be signed in to change notification settings - Fork 94
Home
Rumen Damyanov edited this page Jul 29, 2025
·
13 revisions
This directory contains comprehensive examples showing how to use the php-feed package with different frameworks and scenarios.
- Laravel Examples - Using php-feed with Laravel framework
- Symfony Examples - Using php-feed with Symfony framework
- Plain PHP Examples - Using php-feed with vanilla PHP
- Basic Feed - Simple RSS/Atom feed generation
- Multiple Feeds - Creating different feeds for different content types
- Caching - Implementing feed caching for better performance
- Custom Views - Using your own feed templates
- Feed Links - Generating feed discovery links
- Advanced Features - Categories, enclosures, and more
- Blog Feed Example - Complete blog feed implementation
- News Feed Example - Multi-category news feed
- E-commerce Feed - Product feeds for e-commerce
For the fastest setup, check out the Basic Feed example, which shows the simplest way to get started:
use Rumenx\Feed\FeedFactory;
$feed = FeedFactory::create();
$feed->setTitle('My Feed');
$feed->setDescription('Latest updates');
$feed->setLink('https://example.com');
$feed->addItem([
'title' => 'Hello World',
'author' => 'John Doe',
'link' => 'https://example.com/hello',
'pubdate' => date('c'),
'description' => 'First post content'
]);
echo $feed->render('rss');
All examples have been updated for the new framework-agnostic architecture:
- β
Factory Method: Use
FeedFactory::create()
instead of service providers - β Modern PHP: PHP 8.3+ with strict typing and modern syntax
- β Framework Agnostic: Works with any framework or plain PHP
- β
Array-based Items: Use
addItem([...])
instead of individual parameters - β Fluent Interface: Chain methods for cleaner code
- β Better Type Safety: Full type declarations and PHPStan compliance
If you're upgrading from older versions, the main changes are:
// Old way (v0.x)
$feed = App::make("feed");
$feed->title = 'My Feed';
$feed->add($title, $author, $url, $date, $description, $content);
// New way (v1.x)
$feed = FeedFactory::create();
$feed->setTitle('My Feed');
$feed->addItem([
'title' => $title,
'author' => $author,
'link' => $url,
'pubdate' => $date,
'description' => $description
]);
See individual examples for complete migration patterns.