PHP code example of alleyinteractive / feed-consumer

1. Go to this page and download the library: Download alleyinteractive/feed-consumer 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/ */

    

alleyinteractive / feed-consumer example snippets


add_filter( 'feed_consumer_processors', function ( array $processors ) {
	$processors[] = My_Plugin\Processor::class;

	return $processors;
} );

add_action( 'feed_consumer_run_complete', function ( int $feed_id, $loaded_data, string $processor ) {
	// Do something.
}, 10, 3 );

add_action( 'feed_consumer_extractor_error', function ( $response, \Feed_Consumer\Contracts\Extractor $extractor ) {
	// Do something.
}, 10, 2 );

use Mantle\Http_Client\Pending_Request;
use Feed_Consumer\Contracts\Processor;

add_action( 'feed_consumer_pre_feed_fetch', function ( Pending_Request $request, Processor $processor, array $settings ) {
	// Do something.
}, 10, 3 );

use Mantle\Http_Client\Response;
use Feed_Consumer\Contracts\Processor;

add_action( 'feed_consumer_feed_fetch', function ( Response $response, Processor $processor, array $settings ) {
	// Do something.
}, 10, 3 );