beehexa/webhook-php

Webhook library for Beehexa packages

Installs: 117

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/beehexa/webhook-php

v1.2.3 2025-06-23 09:30 UTC

This package is auto-updated.

Last update: 2025-09-23 09:55:50 UTC


README

PHP Library, which used for pushing a message to a webhook.

Installation

Type 1: Composer

composer require beehexa/webhook-php

How to use the library

$messageBuilder = new Beehexa\WebhookPhp\Hook\Data\MessageBuilder();
$messageBuilder->setText('product');
$messageBuilder->setEntityId(123);
$messageBuilder->addField('event_name', 'update');
$messageBuilder->addField('entity_type', 'entity_type');
$messageBuilder->addField('entity_id', 'entity_id');
$message = $messageBuilder->build();

/// Sample Slack stretagy::
$hookURL = 'https://hooks.slack.com/services/xxxx/xxxx/xxxx';
$hookStrategy = new Beehexa\WebhookPhp\Hook\Strategy\SlackChannel($hookURL);

$hookContext = new \Beehexa\WebhookPhp\HookContext($hookStrategy);
$hookContext->exec($message);