<commit_before># WyriHaximus/PhergieHttp

[Phergie](http://github.com/phergie/phergie-irc-bot-react/) plugin for Provide HTTP functionality to other plugins.

[![Build Status](https://secure.travis-ci.org/WyriHaximus/PhergieHttp.png?branch=master)](http://travis-ci.org/WyriHaximus/PhergieHttp)

## Install

The recommended method of installation is [through composer](http://getcomposer.org).

```JSON
{
    "require": {
        "wyrihaximus/phergie-http": "dev-master"
    }
}
```

See Phergie documentation for more information on
[installing and enabling plugins](https://github.com/phergie/phergie-irc-bot-react/wiki/Usage#plugins).

## Configuration

```php
new \WyriHaximus\Phergie\Plugin\Http\Plugin(array(



))
```

## Usage

```php
$deferred = new Deferred();
$deferred->promise()->then(function () { // Fires when the request has been completed
    echo 'DONE';
}, function() { // Fires when an error occurred
    echo 'FAIL';
}, function($data) { // Fires when the response is in and from there for every chunk of data. $data = array('type' => 'response|data', 'payload' => 'the data for this event')
    echo $data['type'];
});
$this->emitter->emit('http.request', array(
    $deferred,
    'GET',
    'https://github.com/',
));
```

## Tests
<commit_msg>Readme update<commit_after># WyriHaximus/PhergieHttp

[Phergie](http://github.com/phergie/phergie-irc-bot-react/) plugin for Provide HTTP functionality to other plugins.

[![Build Status](https://secure.travis-ci.org/WyriHaximus/PhergieHttp.png?branch=master)](http://travis-ci.org/WyriHaximus/PhergieHttp)

## Install

The recommended method of installation is [through composer](http://getcomposer.org).

```JSON
{
    "require": {
        "wyrihaximus/phergie-http": "dev-master"
    }
}
```

See Phergie documentation for more information on
[installing and enabling plugins](https://github.com/phergie/phergie-irc-bot-react/wiki/Usage#plugins).

## Configuration

```php
new \WyriHaximus\Phergie\Plugin\Http\Plugin(array(



))
```

## Usage

```php
$deferred = new Deferred();
$deferred->promise()->then(function () { // Fires when the request has been completed
    echo 'DONE';
}, function() { // Fires when an error occurred
    echo 'FAIL';
}, function($data) { // Fires when the response is in and from there for every chunk of data. $data = array('type' => 'response|data', 'payload' => 'the data for this event')
    echo $data['type'];
});
$this->emitter->emit('http.request', array(
    $deferred, // Required
    'GET', // Required
    'https://github.com/', // Required
    array('user-agent' => 'PhergieHttp'), // Optional
    'POSTBODY', // Optional
));
```

## Tests

{'fraction_non_alphanumeric': 0.1720632530120482, 'fraction_numerical': 0.0, 'mean_word_length': 4.139264990328821, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1578660', 'n_tokens_mistral': 906, 'n_tokens_neox': 872, 'n_words': 201}