Download the PHP package ufo-tech/kafka-messenger without Composer

On this page you can find all versions of the php package ufo-tech/kafka-messenger. 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 kafka-messenger

KafkaMessenger

Ukraine

Kafka transport for Symfony Messenger, built directly on librdkafka

About this package

This package lets a Symfony application send and consume Kafka messages through the Messenger component.

A message that Kafka never acknowledged should never look delivered.

License Size package_version fork

Environment Requirements

php_version symfony_version

PHP 8.2 or newer with ext-rdkafka, and Symfony Messenger 7.3 or newer. One tag covers both lines — the suite is run against 7.3 and against 8.1, with the same code. Beyond Messenger itself the package pulls in nothing: psr/log and four Symfony components, no HTTP client, no serializer, no schema registry.

Installation

Symfony Flex registers the bundle. Without Flex, add it to config/bundles.php:

Configuration

Any other key stops the transport at startup and the error names the ones it accepts. Values in kafka_conf are turned into strings for you, so a YAML false reaches librdkafka as "false" rather than as an empty value.

A consumer needs group.id: without it there is nowhere to keep the offset, and the transport says so instead of letting librdkafka abort. enable.auto.commit is set to false unless you choose otherwise — with auto-commit on, a background thread moves the offset and neither ack nor reject decides anything any more.

DSN

The whole configuration fits in the connection string:

Part Becomes
scheme security.protocol
user:pass sasl.username and sasl.password, accepted only on a kafka+sasl… scheme
hosts, comma separated the broker list
path the topic
query key with a dot a librdkafka property, same as kafka_conf
query key without a dot a transport option, checked against the same list as above

What the DSN says wins over the options array, the way it does in Symfony's own transports.

Scheme security.protocol
kafka:// plaintext
kafka+ssl:// ssl
kafka+sasl:// sasl_plaintext
kafka+sasl+ssl:// sasl_ssl

A value you set in kafka_conf always beats the scheme. Mixing schemes in one DSN is an error: security.protocol covers the whole client, not one broker.

Partition key

Messages sharing a key land in the same partition and keep their order:

Batches and unreadable messages

The receiver hands back a batch whenever the worker asks for one: the first message waits for receive_timeout, the rest are collected without waiting, as many as are already buffered. Symfony's worker learned to ask (messenger:consume --fetch-size=10) in 8.1, so on 7.3 and 8.0 every call brings a single message.

A message the serializer cannot decode comes back as an envelope carrying MessageDecodingFailedException, the shape ReceiverInterface asks a transport for. The worker routes it through the usual retry and failure path and acks it, so the offset moves on and one bad message cannot stop a partition.

What the failure transport keeps depends on the Symfony line. From 8.1 its serializers return that exception with the original encoded envelope inside it, so the original body travels with it into the failure transport and messenger:failed:retry decodes it again once the reason is fixed. On 7.3 and 8.0 the serializer throws instead, the exception has nowhere to carry the payload, and the failure transport keeps the exception alone.

How it works

Kafka\Connection is the only place that talks to librdkafka: clients, delivery reports, offsets, rebalances, leaving the group. Transport\KafkaSender and Transport\KafkaReceiver speak only Messenger — serialization, stamps, ack and reject — and share one connection. Kafka\Dsn and Kafka\Options parse the configuration and refuse what they do not recognise.

The transport implements CloseableTransportInterface: when a worker stops, the consumer leaves its group at once and the partitions move to its neighbours immediately instead of after session.timeout.ms.

More from UFO-Tech

This and seventeen other packages published under the ufo-tech vendor on Packagist.


All versions of kafka-messenger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-rdkafka Version *
psr/log Version ^2.0||^3.0
symfony/config Version ^7.3||^8.0
symfony/dependency-injection Version ^7.3||^8.0
symfony/http-kernel Version ^7.3||^8.0
symfony/messenger Version ^7.3||^8.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 ufo-tech/kafka-messenger contains the following files

Loading the files please wait ...