inboxly/receiver

Inboxly Receiver.

v0.2.0 2021-08-18 09:48 UTC

This package is auto-updated.

Last update: 2021-11-18 10:24:48 UTC


README

This package used as part of the Inboxly service.

Explore sites to find feeds and fetch feeds with last entries.

Install

You can install the package via composer:

composer require inboxly/receiver

Usage

Explore site to find feeds

<?php

use Inboxly\Receiver\Managers\ExplorerManager;

class ExploreController
{
    public function explore(ExplorerManager $manager, string $site){
        $result = $manager->explore($site, 'rss');
        
        /** @var \Inboxly\Receiver\Sources\Rss\RssParameters $parameters */
        foreach ($result as $parameters) {
            dump("Found feed: $parameters->url");
        }
    }
}

Fetch feed with entries

<?php

use Inboxly\Receiver\Contracts\Parameters;
use Inboxly\Receiver\Managers\FetcherManager;

class FetchController
{
    public function fetch(FetcherManager $manager, Parameters $parameters){
        $feeds = $manager->fetch($parameters);

        /** @var \Inboxly\Receiver\Feed $feed */
        foreach ($feeds as $feed) {
            dump("Fetched feed: $feed->name");
            
            /** @var \Inboxly\Receiver\Entry $entry */
            foreach ($feed->entries as $entry) {
                dump("Entry in feed: $entry->name");
            }
        }
    }
}

Testing

Run the tests with:

composer test

Credits

License

The MIT License (MIT). Please see License File for more information.