2017 © Pedro Peláez
 

library phergie-irc-plugin-http

Phergie plugin for Provide HTTP functionality to other plugins

image

phergie/phergie-irc-plugin-http

Phergie plugin for Provide HTTP functionality to other plugins

  • Saturday, March 25, 2017
  • by svpernova09
  • Repository
  • 4 Watchers
  • 3 Stars
  • 1,055 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 13 Versions
  • 1 % Grown

The README.md

HTTP Plugin

Phergie plugin for Provide HTTP functionality to other plugins., (*1)

Build Status, (*2)

Install

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

composer require phergie/phergie-irc-plugin-http 

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

Requirements

The HTTP plugin requires the DNS plugin to be setup for DNS resolving., (*5)

Configuration

return [

    'plugins' => [

        // dependency
        new \Phergie\Plugin\Dns\Plugin, // Needed to do DNS lookups

        new \Phergie\Plugin\Http\Plugin([

            // All configuration is optional

            'dnsResolverEvent' => 'dns.resolver', // Event for retrieving the DNS resolver, defaults to 'dns.resolver'

            'guzzleClientOptions' => [], // Array with options passed into the Guzzle Client constructor (don't set a handler in here it will be overwritten)

        ]),

    ]
];

Usage

Get Guzzle HTTP Client

$this->emitter->emit('http.client', [
    function (GuzzleHttp\Client $client) {
        // Make HTTP requests as documented on the Guzzle docs: http://guzzle.readthedocs.org/en/latest/clients.html#asynchronous-requests
        // When making requests make sure to pass the future flag as documented: http://guzzle.readthedocs.org/en/latest/faq.html#can-guzzle-send-asynchronous-requests
    },
]);

Make a HTTP request

$this->emitter->emit('http.request', [new \Phergie\Plugin\Http\Request([
    'url' => 'https://github.com/',                     // Required
    'resolveCallback' => function($response) { // Required
        // Data received do something with it
    },
    'method' => 'GET',                                  // Optional, request method
    'headers' => array(),                               // Optional, headers for the request
    'body' => '',                                       // Optional, request body to write after the headers
    'rejectCallback' => function($error) {},            // Optional, callback that gets triggered on connection errors
])]);

A note about resolveCallback and rejectCallback. rejectCallback will only fire on a socket error. So resolveCallback will be called no matter what HTTP status code as the request has been successful on a connection level. Choosing the appropriate response to a status code is up to the event callee., (*6)

Tests

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

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

License

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

The Versions

25/03 2017

dev-master

9999999-dev

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

21/01 2017

4.1.0

4.1.0.0

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

13/01 2016

4.0.1

4.0.1.0

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

31/12 2015

dev-WyriHaximus-patch-callReject

dev-WyriHaximus-patch-callReject

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

29/12 2015

4.0.0

4.0.0.0

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

29/12 2015

dev-version-2-updates

dev-version-2-updates

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

15/11 2015

3.0.1

3.0.1.0

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

13/09 2015

3.0.0

3.0.0.0

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

13/09 2015

3.0.0-alpha1

3.0.0.0-alpha1

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

20/02 2015

2.1.1

2.1.1.0

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

25/12 2014

2.1.0

2.1.0.0

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

16/11 2014

2.0.0

2.0.0.0

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin

25/06 2014

1.0.0

1.0.0.0

Phergie plugin for Provide HTTP functionality to other plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin bot irc react phergie phergieplugin