yaroslawww/laravel-external-feed-parser

1.1.0 2022-01-20 15:16 UTC

This package is auto-updated.

Last update: 2022-06-20 16:20:44 UTC


README

Packagist License Packagist Version Total Downloads Build Status Code Coverage Scrutinizer Code Quality

"Template method" package to parse external feed.

Installation

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"

Usage

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')
    });

Credits

  • Think Studio