"Template method" package to parse external feed.
Install the package via composer:
composer require yaroslawww/laravel-external-feed-parser
Optionally you can publish the config file with:
php artisan vendor:publish --provider="ExternalFeedParser\ServiceProvider" --tag="config"
Add config to config/services.php
or config/external-feed-parser.php
.
'jobs-feeds' => [
'foobar' => [
'pull' => [
'class' => \ExternalFeedParser\Pull\XmlFeedPull::class,
'options' => [
'url' => 'https://www.foobar.co.uk/rssfeed/example.aspx',
'listingKey' => 'baz',
],
],
'convert' => [
'class' => \ExternalFeedParser\Converters\SimpleConverter::class,
'options' => [
'entityClass' => \ExternalFeedParser\Entity\ExternalEntity::class,
],
],
],
],
FeedParser::provider('foobar')
->parse()
->each(function (ExternalEntity $entity) {
$entity->get('baz')
});