Download the PHP package rasuvaeff/yii3-outbox-webhooks-bridge without Composer

On this page you can find all versions of the php package rasuvaeff/yii3-outbox-webhooks-bridge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii3-outbox-webhooks-bridge

rasuvaeff/yii3-outbox-webhooks-bridge

Stable Version Total Downloads Build Static analysis Psalm level Русская версия

Bridges yii3-outbox and yii3-webhooks for durable at-least-once webhook delivery. Each outbox message is converted to a WebhookEvent and dispatched to configured endpoints via an injected WebhookDispatcher.

Using an AI coding assistant? llms.txt has a compact API reference designed for LLMs.

Requirements

Installation

Usage

1. Configure endpoints

2. Wire the publisher

3. Run the outbox processor

process() takes no arguments; what the processor claims is decided by types: at construction. Leave it out and it claims every pending message in the storage, whatever its type — see the next section before doing that on an outbox other consumers read from.

Sharing an outbox with other consumers

OutboxWebhookPublisher treats a message type with no configured endpoints as delivered: publish() returns, the Processor calls markPublished(), and the message is gone. That is harmless while webhooks are the only consumer. It is data loss the moment another consumer claims from the same storage by type — a ClickHouseOutboxExporter from rasuvaeff/yii3-outbox-clickhouse, for instance, claims only the types it routes, but an unscoped Processor claims everything, including those, and the publisher acknowledges them with zero deliveries. Nothing logs it and no alert fires.

Scope the processor to the types the publisher owns. With ConfigWebhookEndpointProvider that is one call — configuredTypes() lists every type that has at least one endpoint — and with a provider of your own it is the list you would give the provider anyway:

The scope reaches the storage's claim(), so a foreign message is never even seen. Two further lines of defence, for when the scope cannot be trusted to stay in step with the endpoint map:

Behaviour

Situation Result
Endpoint returns Delivered Delivery saved; message marked published
Endpoint returns Failed Delivery saved; PublishException thrown → outbox retries
Dispatcher throws PublishException thrown → outbox retries
No endpoints for type Silent success (zero deliveries, message published) — see Sharing an outbox
Multiple endpoints, one fails All dispatched; PublishException thrown → all retried

Retry is all-or-nothing across endpoints

Fan-out has no partial state. If a type maps to five endpoints and the fifth fails, publish() throws — and the outbox retries the message, not the one endpoint. The next attempt dispatches to all five again, so the four that already succeeded receive the event a second time.

This is deliberate: the bridge keeps no per-endpoint delivery cursor, and adding one would duplicate state that WebhookDeliveryStorage already records. But it has consequences you must design for:

Consequence What to do
Healthy endpoints get duplicates whenever any sibling fails Receivers must deduplicate on the event id — see below. This is a requirement, not a recommendation
WebhookDeliveryStorage gets a second row for an endpoint that already succeeded Do not put a unique constraint on (event_id, endpoint_url). It will raise a duplicate-key error on a perfectly normal retry, and that error surfaces as a delivery failure rather than as the schema problem it is
One permanently broken endpoint keeps the whole message retrying The message reaches Failed after maxAttempts and stops — but every attempt until then re-delivers to the healthy endpoints. Keep maxAttempts low, or give a flaky endpoint its own message type so its failures cannot drag siblings along

Event id dedup

The outbox message id is reused as the WebhookEvent id, unchanged. On retry — including the all-or-nothing retry above — the same id is sent again, which is what makes receiver-side deduplication possible at all.

Receivers must key idempotency on that id. It travels in the X-Webhook-Id header when your dispatcher signs with HmacSha256Signer from yii3-webhooks; with a different dispatcher, make sure the id is transmitted somehow, or receivers have nothing to deduplicate on.

Two further contract details worth knowing:

Custom endpoint provider

Implement WebhookEndpointProvider to load endpoints from a database, cache, or any runtime source:

Security

Showing delivery rows: UrlMasker

webhook_deliveries stores endpoint_url and last_error — both carry the endpoint's secrets, and whatever renders them (an operator page, an admin view, an API) needs the same redaction the bridge applies to its logs. UrlMasker is public API for exactly that; use it instead of a local copy:

Both are pure static functions; masking keeps scheme, host, port, path and query keys so the output stays diagnosable, and replaces the userinfo password, query values and the fragment with ***.

Examples

See examples/ for runnable scripts.

Development

License

BSD-3-Clause. See LICENSE.md.


All versions of yii3-outbox-webhooks-bridge with dependencies

PHP Build Version
Package Version
Requires php Version 8.3 - 8.6
rasuvaeff/yii3-outbox Version ^1.7
rasuvaeff/yii3-webhooks Version ^1.0 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rasuvaeff/yii3-outbox-webhooks-bridge contains the following files

Loading the files please wait ...