Download the PHP package zeusi/asyncapi-bundle without Composer

On this page you can find all versions of the php package zeusi/asyncapi-bundle. 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 asyncapi-bundle

AsyncAPI Bundle

Packagist Version PHP CI PHPStan Coverage

Symfony bundle to generate AsyncAPI 3.x documentation from your message DTOs, always in sync with the code.

Unlike REST API tooling, which can enumerate controllers and routes, an event-driven app offers no natural anchor for discovering its messages — and AsyncAPI doesn't impose one. So the bundle takes the simplest pragmatic route: each message is declared with an attribute on its DTO. Its payload schema is derived from the PHP class (via zeusi/json-schema-extractor) and assembled into a valid AsyncAPI 3.x document. Because the schema comes from the code, changing a DTO changes the docs.

Features

Requirements

Installation

If you don't use Symfony Flex, register the bundle in config/bundles.php:

Minimal configuration — just your document's info:

Declare a message

Mark each message DTO with #[AsyncApiMessage]:

The bundle scans your code for #[AsyncApiMessage], derives each payload schema from the DTO, and assembles a valid AsyncAPI 3.x document. You'll typically add a channel (and other metadata) — see the attribute reference.

Expose the document and UI

Import the bundle's controller routes:

You now have:

Configuration reference

Attribute reference

#[AsyncApiMessage] carries the message-level documentation and its placement.

Argument Type Default Purpose
channel ?string null Grouping key; null gives the message a channel of its own.
action OperationAction Send Send (the app publishes) or Receive (the app consumes).
name ?string class short name Message name / components key.
title ?string the message name Human title (shown in the UI).
summary ?string null One-line summary.
description ?string null Longer description (CommonMark).
contentType ?string null → application/json Payload content type. Left null, a routed Messenger transport's serializer can set it; otherwise it renders as application/json.
tags list<string\|Tag> [] Free-form tags; a plain string is shorthand for new Tag(name: …).
externalDocs ?ExternalDocumentation null Link to external documentation for this message.
correlationId ?CorrelationId null Where the correlation id lives in the message (a runtime expression).

The message name defaults to the class short name. For a stable public contract, set an explicit name so renaming the PHP class doesn't change it (a duplicate name across two classes is reported as a warning).

The richer arguments take value objects, constructed inline in the attribute:

What it produces

The generation is an opinionated, code-derivable subset of AsyncAPI (the model can express more — see Discovery and extending):

Payload schemas

Payloads are derived from your DTOs by zeusi/json-schema-extractor. The bundle wires a default SchemaExtractor for you — no setup required:

To use your own, register it as a service and set the schemas.extractor.service config key to its id.

The serialization context is decided at extraction time, not baked into the DTO: which serialization groups (or other ExtractionContext capabilities) apply is a per-message choice that must reach the extractor. Supply it by implementing Payload\ExtractionContextFactory and wiring it via schemas.extractor.context_factory; its create(ExtractionTarget, DocumentContext) returns the ExtractionContext passed to the extractor (or null for none). This keeps extractor-specific knowledge (e.g. which Symfony Serializer groups select a payload's shape) in your code, not in the bundle.

Symfony Messenger

AsyncAPI describes events flowing over a broker, but Symfony has no first-class notion of "a published event" to hang that on. The closest thing is Messenger — it's where transports, routing and serialization are already declared — which makes it the one sensible anchor in the ecosystem. How widely teams use Messenger for public events (rather than internal async work) is honestly unclear, so both capabilities are off by default: turn them on only where your Messenger transports really are your publication channel. A message can also pass through an internal Messenger queue and be published by some other mechanism — which the bundle can't see — so enabling this is your assertion that, for the documented transports, Messenger is how the event goes out.

When symfony/messenger is installed, the bundle reads that setup to fill in the parts of the document that live in your infrastructure rather than your DTOs. It reuses Messenger's own routing semantics — the same type matching Messenger uses to pick a transport — so what it documents matches where your messages actually go.

With providers.messenger.enrichment: true, for each documented message routed to a transport it adds:

transports is an allowlist scoping which transports the integration considers (empty = all; failure transports always excluded) — use it to keep internal transports out of the document.

Discovering messages from routing

Optionally, the routing map itself becomes a message source — so classes you've already routed don't need the attribute. Turn it on with providers.messenger.discovery: true:

A routing-discovered message has no human metadata (its name is the class short name and its placement is send), but its payload is still derived from the class. Use the attribute when you want titles, summaries, tags or an explicit channel; let routing-discovery cover the rest.

Discovery and extending

You've seen two message sources — the #[AsyncApiMessage] attribute and Messenger routing. Neither is the boundary: the document is assembled by an extensible pipeline, so you can add sources of your own and refine anything in the output before it's served.

The general extension point is the processor. Implement Zeusi\AsyncApiBundle\Processor\AsyncApiProcessorInterface (services tagged asyncapi.processor — autoconfigured — ordered by priority) to add or refine anything in the document: channels, operations, messages, top-level fields. It receives the whole document, a context (which document is being generated) and a generation state, so it can build straight from operations, a channel registry, or any source that isn't message-shaped. The generation state is a per-run scratchpad for metadata a processor needs to hand to a later one without it ending up in the document, such as the class a message's payload was derived from. The built-in behaviour is itself just a series of these processors, and yours slot in by priority.

Higher priority runs first. The built-in pipeline, for reference — pick a priority relative to these to slot yours in:

Processor Priority Does
ConfigProcessor 1000 merges the static document config into the model
DiscoveryProcessor 500 assembles channels/operations/messages from the providers
MessengerServerProcessor 400 adds servers, content types and channel↔server links from Messenger transports — only when providers.messenger.enrichment is on
PayloadProcessor -100 derives each message's payload schema
CanonicalizeMessagesProcessor -500 hoists channel messages into components.messages
CanonicalizeSchemasProcessor -600 hoists the types a payload references into components.schemas
VersionValidationProcessor -1000 rejects an unsupported asyncapi version (runs last)

A processor left at the default priority 0 runs after discovery (the channels/operations/messages exist, messages still inline) and before payload derivation — a sensible default for refining the discovered document.

For message-shaped sources specifically, there's a narrower convenience seam: implement Zeusi\AsyncApiBundle\Discovery\MessageProviderInterface to yield messages from somewhere other than attributes (a registry, say — Messenger routing is one such provider the bundle ships), and the built-in discovery processor assembles the channels and operations for you. Reach for this when your source really is a flat list of messages; otherwise, write a processor.

Where it pays off most

AsyncAPI shines as an event contract between services: a shared broker (AMQP / Kafka / SQS / Pub-Sub) with heterogeneous consumers, where the JSON payload is a public contract others depend on.

If your events stay inside a single app — internal queues (doctrine://, redis://) with no external consumer — there's no cross-service contract to publish. The documentation can still earn its keep, though: a schema catalog for onboarding and for understanding the event flow.

License

This project is licensed under the MIT License. See the LICENSE file for details.


All versions of asyncapi-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
psr/log Version ^1.0 || ^2.0 || ^3.0
symfony/config Version ^6.4 || ^7.0 || ^8.0
symfony/dependency-injection Version ^6.4 || ^7.0 || ^8.0
symfony/finder Version ^6.4 || ^7.0 || ^8.0
symfony/http-foundation Version ^6.4 || ^7.0 || ^8.0
symfony/http-kernel Version ^6.4 || ^7.0 || ^8.0
symfony/routing Version ^6.4 || ^7.0 || ^8.0
symfony/yaml Version ^6.4 || ^7.0 || ^8.0
zeusi/json-schema-extractor Version ^3.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 zeusi/asyncapi-bundle contains the following files

Loading the files please wait ...