Download the PHP package m6web/kafka-bundle without Composer

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

KafkaBundle

Configuration and use of KafkaBundle are based on the RdKafka extension. To consume messages, we decided to use the high level consumer.

Kafka documentation

Installation

For Symfony

`

Register the bundle:

Install the bundle:

Usage

Add the m6_web_kafka section in your configuration file.

By default, the sf3 event dispatcher will throw an event on each command. To disable this feature:

Here a configuration example:

Librdkafka global configuration properties

Note that we decided to use the high level consumer. So you can set the "group.id" option in the consumer configuration.

For the producers, we have one topic configuration for each topic:

Whereas for the consumers, we have one topic configuration for all topics:

Producer

A producer will be used to send messages to the server.

In the Kafka Model, messages are sent to topics partitioned and stored on brokers. This means that in the configuration for a producer you will have to specify the brokers and the topics. You can optionnaly configure the log level and the strategy partitioner.

Because of RdKafka extension limitations, you cannot configure the partitions number or replication factor from the bundle. You must do that from the command line.

After setting your producers with their options, you will be able to produce a message using the produce method :

The RD_KAFKA_PARTITION_UA constant is used according the strategy partitioner.

Consumer

A consumer will be used to get a message from different topics. You can choose to set only one topic by consumer.

In the Kafka Model, messages are consumed from topics partitioned and stored on brokers. This means that for a consumer you will have to specify the brokers and topics in the configuration.

To consume messages, you will have to use the consume method to consume a message:

The messages will be automatically committed except if there is an error. But you can choose not to do it by adding an argument as following:

You can decide to commit manually your message with:

It will commit the last consumed message.

It will give you an object \RdKafka\Message with information about the message : payload, topic, or partition for instance. It is the \RdKafka\Message from the RdKafka extension.

In case there is no more message, it will give you a No more message string. In case there is a time out, it will give you a Time out string.

Exceptions list


All versions of kafka-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
ext-rdkafka Version *
kwn/php-rdkafka-stubs Version ^0.0.5
symfony/dependency-injection Version ~2.6||~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 m6web/kafka-bundle contains the following files

Loading the files please wait ....