KitHook PHP RabbitMQ

🚧 Attention: the project is currently under development! 🚧
Note: Before using it, you need to deploy and configure KitHook
This project acts as an extension of kithook-php and allows you to use the RabbitMq queue manager to send messages to KitHook
Install
Via Composer
$ composer require terentev-space/kithook-php-rabbitmq
Usage
Data:
$yourWebhookUri = 'https://example.com';
$yourWebhookId = 'myId-123';
$yourElseContentType = 'application/xml';
$yourWebhookJsonData = [
'anything'
];
$yourWebhookFormData = [
'param1' => 'value1',
];
$yourWebhookQueryData = [
'param1' => 'value1',
];
$yourWebhookXmlData = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<example>
<!-- ... -->
</example>
XML;
$yourClientConfig = [
\KitHookRabbit\Client::CONFIG_RABBIT_HOST => 'localhost',
\KitHookRabbit\Client::CONFIG_RABBIT_PORT => 5672,
\KitHookRabbit\Client::CONFIG_RABBIT_LOGIN => 'guest',
\KitHookRabbit\Client::CONFIG_RABBIT_PASSWORD => 'guest',
\KitHookRabbit\Client::CONFIG_RABBIT_QUEUE => 'kithook',
\KitHookRabbit\Client::CONFIG_RABBIT_VHOST => '/',
];
Examples:
$client = isset($yourClientConfig) ?
new \KitHookRabbit\Client($yourClientConfig) :
new \KitHookRabbit\Client();
$client->sendHttpPutJson($yourWebhookUri, $yourWebhookJsonData, $yourWebhookId);
$client->sendHttpPostForm($yourWebhookUri, $yourWebhookFormData, $yourWebhookId);
$client->sendHttpGetEmpty($yourWebhookUri . '?' . http_build_query($yourWebhookQueryData), $yourWebhookId);
$content = $client->contentBuilder()->makeHttp()
->withType(\KitHook\Entities\Messages\Contents\QueueHttpMessageContent::TYPE_ELSE)
->withData($yourWebhookXmlData)
->withFormatForElseType($yourElseContentType)
->fillElse($yourWebhookXmlData, $yourElseContentType)
->build();
$message = $client->messageBuilder()->makeHttp()
->withId($yourWebhookId)
->withUri($yourWebhookUri)
->withMethod(\KitHook\Entities\Messages\QueueHttpMessage::METHOD_POST)
->withContent($content)
->fillPost($yourWebhookUri, $yourWebhookId, $content, [], [])
->fillPost($yourWebhookUri, $yourWebhookId)
->makeContent()
->fillForm($yourWebhookFormData)
->buildFromMessage()
->build();
$client->send($message);
Credits
License
The Apache 2.0 License (Apache-2.0). Please see License File for more information.