phergie/phergie-irc-plugin-react-feedticker

This package is abandoned and no longer maintained. No replacement package was suggested.

Phergie plugin for syndicating data from feed items to channels or users

1.0.0 2014-12-27 19:46 UTC

This package is not auto-updated.

Last update: 2020-03-20 16:19:03 UTC


README

This repo is being kept for posterity and will be archived in a readonly state. If you're interested it can be forked under a new Composer namespace/GitHub organization.

phergie/phergie-irc-plugin-react-feedticker

Phergie plugin for syndicating data from feed items to channels or users.

Build Status

Install

The recommended method of installation is through composer.

{
    "require": {
        "phergie/phergie-irc-plugin-react-feedticker": "dev-master"
    }
}

See Phergie documentation for more information on installing and enabling plugins.

Configuration

return array(
    'plugins' => array(
        // dependencies
        new \WyriHaximus\Phergie\Plugin\Dns\Plugin,
        new \WyriHaximus\Phergie\Plugin\Http\Plugin,

        new \Phergie\Irc\Plugin\React\FeedTicker\Plugin(array(

            // required: list of feed URLs to poll for content
            'urls' => array(
                'http://feeds.mashable.com/Mashable',
                'http://readwrite.com/rss.xml',
                // ...
            ),
        
            // required: lists of channels or users to receive syndicated feed items
            //           keyed by associated connection mask
            'targets' => array(
                'nick1!user1@host1' => array(
                    '#channel1',
                    'user1',
                    // ...
                ),
                'nick2!user2@host2' => array(
                    '#channel2',
                    'user2',
                    // ...
                ),
                // ...
            ),
        
            // optional: time in seconds to wait between polls of feeds for new
            //           content, defaults to 300 (5 minutes)
            'interval' => 300,
        
            // optional: object implementing \Phergie\Irc\Plugin\React\FeedTicker\FormatterInterface
            //           used to format data from feed items prior to their syndication
            'formatter' => new DefaultFormatter(
                '%title% [ %link% ] by %authorname% at %datemodified%',
                'Y-m-d H:i:s'
            ),
        )),
    ),
);

Default Formatter

The default formatter, represented by the DefaultFormatter class, should be sufficient for most use cases. Its constructor accepts two parameters. The first is a string containing placeholders for various data from feed items. Below is a list of the supported placeholders:

  • %authorname%
  • %authoremail%
  • %authoruri%
  • %content%
  • %datecreated%
  • %datemodified%
  • %description%
  • %id%
  • %link%
  • %links%
  • %permalink%
  • %title%
  • %commentcount%
  • %commentlink%
  • %commentfeedlink%

The second parameter is an optional string containing a date format to use when formatting the value of the %datecreated% and %datemodified% placeholders. It defaults to the ISO-8601 format.

Custom Formatters

In cases where DefaultFormatter does not meet your needs, you can create your own formatter. This is merely a class that implements FormatterInterface.

Tests

To run the unit test suite:

curl -s https://getcomposer.org/installer | php
php composer.phar install
cd tests
../vendor/bin/phpunit

License

Released under the BSD License. See LICENSE.