1. Go to this page and download the library: Download phil/feed-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Phil\FeedBundle\Application\Contract\FeedSource;
use Phil\FeedBundle\Domain\ValueObject\Channel;
use Phil\FeedBundle\Domain\ValueObject\FeedItem;
use Phil\FeedBundle\Domain\ValueObject\FeedPage;
use Phil\FeedBundle\Domain\ValueObject\FeedQuery;
use Phil\Publishing\Contract\PageEvent;
use Phil\Url\Url;
final readonly class NewsFeed implements FeedSource
{
public function __construct(private NewsRepository $news) {}
public function name(): string { return 'news'; }
public function channel(): Channel
{
return new Channel('News', Url::fromString('https://example.org/news'), language: 'en');
}
public function items(FeedQuery $query): FeedPage
{
$items = array_map(static fn (News $news): FeedItem => new FeedItem(
'tag:example.org,2026:news-'.$news->id,
$news->title,
Url::fromString($news->url),
$news->publishedAt,
summary: $news->summary,
contentHtml: $news->html,
), $this->news->latest($query->offset(), $query->limit + 1));
return new FeedPage($items);
}
public function
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.