{"id":36253074,"url":"https://github.com/mshauneu/php-rd-kafka-bundle","last_synced_at":"2026-01-11T07:02:39.508Z","repository":{"id":57021427,"uuid":"63898805","full_name":"mshauneu/php-rd-kafka-bundle","owner":"mshauneu","description":"Kafka Symfony Bundle","archived":false,"fork":false,"pushed_at":"2017-04-08T06:42:43.000Z","size":21,"stargazers_count":13,"open_issues_count":3,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-14T04:30:46.746Z","etag":null,"topics":["kafka","php","symfony"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mshauneu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-21T20:02:39.000Z","updated_at":"2022-06-26T17:39:38.000Z","dependencies_parsed_at":"2022-08-23T12:20:38.495Z","dependency_job_id":null,"html_url":"https://github.com/mshauneu/php-rd-kafka-bundle","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mshauneu/php-rd-kafka-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mshauneu%2Fphp-rd-kafka-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mshauneu%2Fphp-rd-kafka-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mshauneu%2Fphp-rd-kafka-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mshauneu%2Fphp-rd-kafka-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mshauneu","download_url":"https://codeload.github.com/mshauneu/php-rd-kafka-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mshauneu%2Fphp-rd-kafka-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28296941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T04:44:51.577Z","status":"ssl_error","status_checked_at":"2026-01-11T04:44:44.232Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kafka","php","symfony"],"created_at":"2026-01-11T07:02:39.435Z","updated_at":"2026-01-11T07:02:39.500Z","avatar_url":"https://github.com/mshauneu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KafkaBundle\n\n## About \nThis [Symfony](https://symfony.com) bundle provides connectivity to the [Kafka](http://kafka.apache.org) publish-subscribe messaging system based on [rdkafka](https://github.com/arnaud-lb/php-rdkafka) binding to [librdkafka](https://github.com/edenhill/librdkafka)\n\n## Installation\nAdd the dependency in your composer.json\n```json\n{\n    \"require\": {\n        \"mshauneu/php-rdkafka-bundle\"\n    }\n}\n```\nEnable the bundle in your application kernel\n```php\n// app/AppKernel.php\npublic function registerBundles() {\n    $bundles = array(\n        // ...\n        new Mshauneu\\RdKafkaBundle\\MshauneuRdKafkaBundle(),\n    );\n}\n```\n## Configuration\nSimple configuration could look like:\n```yaml\nmshauneu_rd_kafka:\n  producers: \n    test_producer: \n      brokers: 127.0.0.1:9092\n      topic: test_topic   \n  consumers:\n    test_consumer:\n      brokers: 127.0.0.1:9092\n      topic: test_topic   \n      properties: \n        group_id: \"test_group_id\"\n      topic_properties: \n        offset_store_method: broker           \n        auto_offset_reset: smallest\n        auto_commit_interval_ms: 100\n```\nConfiguration properties are documented:\n- for producer or  consumer in [CommunicatorConfiguration.php](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/src/Mshauneu/RdKafkaBundle/DependencyInjection/CommunicatorConfiguration.php)\n- for topic to produce in [TopicProducerConfiguration.php](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/src/Mshauneu/RdKafkaBundle/DependencyInjection/TopicProducerConfiguration.php)\n- for topic to consume in [TopicConsumerConfiguration.php](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/src/Mshauneu/RdKafkaBundle/DependencyInjection/TopicConsumerConfiguration.php)\n\n## Usage\n### Publishing messages to a Kafka topic\nFrom a Symfony controller:\n```php\n$payload = 'test_message';\n$topicProducer = $container-\u003eget('mshauneu_rd_kafka')-\u003egetProducer(\"test_producer\");\n$topicProducer-\u003eproduceStart();\n$topicProducer-\u003eproduce(\"message\");\n$topicProducer-\u003eproduceStop();\n``` \nBy CLI:\n```bash\n./app/console kafka:producer --producer test_producer test_message \n```\n\n### Consume messages out of a Kafka topic:\nImplement [ConsumerInterface](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/src/Mshauneu/RdKafkaBundle/Topic/ConsumerInterface.php)\n```php\nclass MessageHandler implements ConsumerInterface {\n\tpublic function consume($topic, $partition, $offset, $key, $payload) {\n\t\techo \"Received payload: \" . $payload . PHP_EOL;\n\t}\n}\n```\nRegister it: \n```yaml\ntest_message_handler:\n    class: MessageHandler\n```\nFrom a Symfony controller:\n```php\n$topicConsumer = $container-\u003eget('mshauneu_rd_kafka')-\u003egetConsumer(\"test_producer\");\n$topicConsumer-\u003econsumeStart(TopicCommunicator::OFFSET_STORED);\n$topicConsumer-\u003econsume($consumerImpl);\n$topicConsumer-\u003econsumeStop();\n```\nBy CLI:\n```bash\n./app/console kafka:consumer --consumer test_consumer --handler test_message_handler \n```\n\n## License\n\nThis project is under the MIT License. See the [LICENSE](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/LICENSE) file for the full license text.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmshauneu%2Fphp-rd-kafka-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmshauneu%2Fphp-rd-kafka-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmshauneu%2Fphp-rd-kafka-bundle/lists"}