Unreleased
Unreleased
Added
- Payload webhooks: a
JsonResourcemarked#[Webhook('order.paid')]declares a webhook without a route. The resource is the required body, described like a returned resource (sampled, a$refcomponent, the media type of its format); the PHPDoc of the class gives the summary and the description;#[Operation],#[Tag],#[Header]and#[Response]on the class complete it. TaggedWebhooksunless#[Operation(tags:)]or a#[Tag]tags it, answered200unless#[Response], its operationId is its name. A class without a name is left out with a warning. The same class is what the application sends (OrderPaid::make($order)->resolve(), or->response()->getData(true)for a resource with a format, documented as its document). #[Webhook(method:)]: the HTTP method of a payload webhook,POSTby default.webhooksin the configuration, overridable per document key by key (documents.<name>.webhooks):paths(published:[app_path()]) are scanned for the payload classes, reading only the files that mentionWebhook; a class that cannot be loaded is skipped with a warning.classeslists payload classes; one that is not a concreteJsonResourcemarked#[Webhook]is an invalid configuration (exit code2).webhooks.include/webhooks.exclude: shell masks on the names of the webhooks of a document (payload and route webhooks),excludeoverinclude;#[Exclude]on a payload class leaves it out of every document.openapi:inspect <name>also shows the webhooks of that name.- A payload webhook and a route webhook of the same name and method keep the payload webhook, with a warning.
Deprecated
- Route webhooks (
#[Webhook]on an action or a controller, on a route registered only to be documented): declare the payload class instead. They keep working in 1.x.