2017 © Pedro Peláez
 

library phergie-irc-plugin-react-url

Phergie plugin for displaying information about URLs

image

phergie/phergie-irc-plugin-react-url

Phergie plugin for displaying information about URLs

  • Tuesday, August 23, 2016
  • by elazar
  • Repository
  • 3 Watchers
  • 0 Stars
  • 739 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 3 Forks
  • 4 Open issues
  • 11 Versions
  • 1 % Grown

The README.md

This project is abandoned

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., (*1)

Url Plugin

Phergie plugin for Display URL information about links., (*2)

Build Status, (*3)

Install

To install via Composer, use the command below, it will automatically detect the latest version and bind it with ~., (*4)

composer require phergie/phergie-irc-plugin-react-url 

See Phergie documentation for more information on installing and enabling plugins., (*5)

Configuration

return array(

    'plugins' => array(

        // dependencies
        new \Phergie\Plugin\Dns\Plugin, // Handles DNS lookups for the HTTP plugin
        new \Phergie\Plugin\Http\Plugin, // Handles the HTTP requests for this plugin

        // configuration
        new \Phergie\Irc\Plugin\React\Url\Plugin(array(
            // All configuration is optional

            'hostUrlEmitsOnly' => false, // url.host.(all|<host>) emits only, no further URL handling / shortening

            // or

            'handler' => new \Phergie\Irc\Plugin\React\Url\DefaultUrlHandler(), // URL handler that creates a formatted message based on the URL

            // or

            'shortenTimeout' => 15 // If after this amount of seconds no url shortener has come up with a short URL the normal URL will be used. (Not in effect when there are no shorteners listening.)

            // or

            'filter' => null // Any valid filter implementing Phergie\Irc\Plugin\React\EventFilter\FilterInterface to filter which messages should be handled 

        )),

    )
);

Events

This plugin emits the following generic, do what ever you want with it, events., (*6)

  • url.host.HOSTNAME For example url.host.twitter.com (www. is stripped from the hostname).
  • url.host.all For all hostnames.

This plugins also emits two events for url shortening. Only called when there are listeners registered. Each event emit is passed a UrlshorteningEvent, if a shortener resolved short url it calls the resolve method on the promise., (*7)

  • url.shorten.HOSTNAME For example url.shorten.twitter.com (www. is stripped from the hostname).
  • url.shorten.all For all hostnames.

Placeholders

The following placeholders can be used to compose a message that is passed as the first argument for DefaultUrlHandler to create custom messages:, (*8)

  • %url% - Full URL
  • %url-short% - Shortened URL
  • %http-status-code% - HTTP status code
  • %timing% - Time in seconds it took for th request to complete
  • %timing2% - Time in seconds it took for th request to complete rounded off to a maximum of two decimals
  • %response-time% - Time in seconds it took for th request to complete
  • %response-time2% - Time in seconds it took for th request to complete rounded off to a maximum of two decimals
  • %title% - Page title
  • %composed-title% - Page title

Header Placeholders

Selection of response headers from: en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_Headers, (*9)

  • %header-age%
  • %header-content-type%
  • %header-content-length%
  • %header-content-language%
  • %header-date%
  • %header-etag%
  • %header-expires%
  • %header-last-modified%
  • %header-server%
  • %header-x-powered-by%

UrlSectionFilter

This plugin comes with the UrlSectionFilter that lets you filter on the different key value pairs coming out of parse_url. The following example filter allows www.phergie.org, www2.phergie.org, and phergie.org:, (*10)

new OrFilter([
    new UrlSectionFilter('host', '*.phergie.org'),
    new UrlSectionFilter('host', 'phergie.org'),
])

The filter comes with a third strict parameter where instead of declaring out of scope on missing an URL part it return false., (*11)

Tests

To run the unit test suite:, (*12)

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

License

Released under the MIT License. See LICENSE., (*13)

The Versions

12/12 2015

2.0.1

2.0.1.0

Phergie plugin for displaying information about URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react

16/11 2015

1.0.x-dev

1.0.9999999.9999999-dev

Phergie plugin for Display URL information about links

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react

16/11 2015

2.0.0

2.0.0.0

Phergie plugin for displaying information about URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react