HTTP Request Wrapper
Simple installation via composer :
composer require "joesama/webhook"If in need of pre-configured connector, a connector class can be created by extending Joesama\Webhook\Connectors\AbstractConnector class and implement
Joesama\Webhook\Connectors\ConnectorContract interface.
class ExamplesConnector extends AbstractConnector implements ConnectorContract
{
/**
* Define configuration parameter to be attach to request.
*/
public function webHookConfiguration(): array
{
return [];
}
/**
* Define request content to be send.
*/
public function webHookContent(): array
{
return [];
}
/**
* Define request header to attach to request.
*/
public function webHookHeader(): array
{
return [];
}
}
To initiate a request can be simply by calling Joesama\Webhook\Web\Hook class and called the getResponse method.
$hook = new Hook();
$hook->setRequestBody([]);
$hook->getResponse('http://www.google.com', 'GET');
To use pre-configured connector, pass it as parameter to the Hook class
$connector = new ExamplesConnector();
$hook = new Hook($connector);
joesama/webhook is open-sourced software licensed under the MIT license.


