{"id":15524246,"url":"https://github.com/leocavalcante/kafka-phplayground","last_synced_at":"2025-04-23T07:31:30.440Z","repository":{"id":72843963,"uuid":"304911731","full_name":"leocavalcante/kafka-phplayground","owner":"leocavalcante","description":"🎸 Just some fun with Kafka, PHP and Swoole","archived":false,"fork":false,"pushed_at":"2020-10-19T17:33:50.000Z","size":311,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-29T22:41:19.028Z","etag":null,"topics":["example","kafka","php","swoole"],"latest_commit_sha":null,"homepage":"","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/leocavalcante.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-17T15:44:17.000Z","updated_at":"2024-07-24T05:52:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"389b3976-edc8-4d60-8cb0-aed4d90c633d","html_url":"https://github.com/leocavalcante/kafka-phplayground","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocavalcante%2Fkafka-phplayground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocavalcante%2Fkafka-phplayground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocavalcante%2Fkafka-phplayground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocavalcante%2Fkafka-phplayground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leocavalcante","download_url":"https://codeload.github.com/leocavalcante/kafka-phplayground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250390924,"owners_count":21422806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["example","kafka","php","swoole"],"created_at":"2024-10-02T10:50:11.233Z","updated_at":"2025-04-23T07:31:30.432Z","avatar_url":"https://github.com/leocavalcante.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kafka PHPlayground\n\n🎸 Just some fun with [Kafka](https://kafka.apache.org/), [PHP](https://www.php.net/) and [Swoole](https://www.swoole.co.uk/).\n\n\u003e Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.\n\n\u003e Swoole is a Coroutine based Async PHP Programming Framework to Build high-performance, scalable, concurrent TCP, UDP, Unix Socket, HTTP, WebSocket services with PHP and fluent Coroutine API.\n\n## Requirements\n\n- PHP \u003e= 7.4 (https://launchpad.net/~ondrej/+archive/ubuntu/php)\n- Swoole \u003e= 4.5 (https://www.swoole.co.uk/docs/get-started/installation)\n- Java \u003e= 8 (https://openjdk.java.net/install/)\n\n## Instructions\n\n### Kafka\n\n- Download it from https://kafka.apache.org/downloads\n- Extract to `\u003cproject root\u003e/kafka`\n  - `test -f kafka/bin/kafka-server-start.sh \u0026\u0026 echo OK` (should print `OK`).\n\n#### Start the services\n\n- `kafka/bin/zookeeper-server-start.sh kafka/config/zookeeper.properties`\n- `kafka/bin/kafka-server-start.sh kafka/config/server.properties`\n\n#### Create a topic\n\n- `kafka/bin/kafka-topics.sh --create --topic my-topic --bootstrap-server localhost:9092`\n  - `Created topic my-topic.` should be the response \n\n### PHP\n\n#### If you don't have Swoole already:\n\n- `pecl install swoole`\n\n#### Install dependencies\n\nMainly https://github.com/easy-swoole/kafka\n\n- `composer install`\n\n#### Start the consumer\n\n- `php consumer.php` \n\n## Let's play!\n\n### Write some events\n\n- `kafka/bin/kafka-console-producer.sh --topic my-topic --bootstrap-server localhost:9092`\n\nThen just type some messages to the stdin. Press `Ctrl+C` to stop.\n\n![Screenshot 01](assets/screenshot-01.png)\n\n### A PHP producer\n\nJust checkout [`producer.php`](producer.php).\n\n![Screenshot 02](assets/screenshot-02.png)\n\n## Let's Rock\n\n### Easy\n\n![Screenshot 03](assets/screenshot-03.png)\n\n![Screenshot 04](assets/screenshot-04.png)\n\n### Medium\n\n![Screenshot 05](assets/screenshot-05.gif)\n\n### Hard\n\n![Screenshot 06](assets/screenshot-06.gif)\n\n\u003e ⚠ Actually, I'm not sure if this is rocking. If you have a proper way to benchmark a consumer, please [issue me](https://github.com/leocavalcante/kafka-phplayground/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocavalcante%2Fkafka-phplayground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleocavalcante%2Fkafka-phplayground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocavalcante%2Fkafka-phplayground/lists"}