desarrolla2/rss-client
Deprecated RSS/Atom feed fetcher (will not be updated; migrate to FastFeed). Simple, fast RSS2.0/Atom1.0 client: add multiple feed URLs under a group name and fetch entries, with optional caching via desarrolla2/cache adapters.
Maybe you need your custom logic for feed process. In this case you need to create a custom processor that implements ProcessorInterface
<?php
use Desarrolla2\RSSClient\Parser\Processor\ProcessorInterface;
class CustomProcessor implements ProcessorInterface
{
/**
* [@var](https://github.com/var) array
*/
protected $mediaTypes = array(
'content',
'keywords',
'thumbnail',
'category',
'comments',
);
/**
* [@param](https://github.com/param) NodeInterface $node
* [@param](https://github.com/param) \DOMElement $item
*
* [@return](https://github.com/return) mixed|void
*/
public function execute(NodeInterface $node, \DOMElement $item)
{
foreach ($this->mediaTypes as $mediaType) {
/* Implement getNodeValueByTagName yourself */
$value = $this->getNodeValueByTagName($item, $mediaType);
if ($value) {
$node->setExtended(
$mediaType,
$value
);
}
}
}
}
And them push it on the top of processors stack.
<?php
use Desarrolla2\RSSClient\RSSClient;
$client = new RSSClient();
$client->pushProcessor( new CustomProcessor($client->getSanitizerHandler()));
Now you can continue normally.
<?php
$client->fetch();
How can I help you explore Laravel packages today?