{"id":15663007,"url":"https://github.com/ytake/php-ksql","last_synced_at":"2025-05-05T23:48:36.056Z","repository":{"id":46793079,"uuid":"131283937","full_name":"ytake/php-ksql","owner":"ytake","description":"Apache Kafka / Confluent KSQL REST Client for PHP","archived":false,"fork":false,"pushed_at":"2021-09-25T13:48:24.000Z","size":122,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":78,"default_branch":"main","last_synced_at":"2024-10-04T13:35:08.578Z","etag":null,"topics":["kafka","ksql","php","php-library","php7"],"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/ytake.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":"2018-04-27T10:47:10.000Z","updated_at":"2023-07-06T19:24:21.000Z","dependencies_parsed_at":"2022-09-14T00:12:01.341Z","dependency_job_id":null,"html_url":"https://github.com/ytake/php-ksql","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ytake%2Fphp-ksql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ytake%2Fphp-ksql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ytake%2Fphp-ksql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ytake%2Fphp-ksql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ytake","download_url":"https://codeload.github.com/ytake/php-ksql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221149624,"owners_count":16764494,"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":["kafka","ksql","php","php-library","php7"],"created_at":"2024-10-03T13:35:13.855Z","updated_at":"2024-10-23T03:02:33.217Z","avatar_url":"https://github.com/ytake.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ytake\\KsqlClient [ytake/php-ksql]\n\nApache kafka / Confluent KSQL REST Client for php\n\n[![Build Status](http://img.shields.io/travis/ytake/php-ksql/master.svg?style=flat-square)](https://travis-ci.org/ytake/php-ksql)\n[![Coverage Status](http://img.shields.io/coveralls/ytake/php-ksql/master.svg?style=flat-square)](https://coveralls.io/github/ytake/php-ksql?branch=master)\n[![Scrutinizer Code Quality](http://img.shields.io/scrutinizer/g/ytake/php-ksql.svg?style=flat-square)](https://scrutinizer-ci.com/g/ytake/php-ksql/?branch=master)\n[![StyleCI](https://styleci.io/repos/131283937/shield?branch=master)](https://styleci.io/repos/131283937)\n\n[![License](http://img.shields.io/packagist/l/ytake/php-ksql.svg?style=flat-square)](https://packagist.org/packages/ytake/php-ksql)\n[![Latest Version](http://img.shields.io/packagist/v/ytake/php-ksql.svg?style=flat-square)](https://packagist.org/packages/ytake/php-ksql)\n[![Total Downloads](http://img.shields.io/packagist/dt/ytake/php-ksql.svg?style=flat-square)](https://packagist.org/packages/ytake/php-ksql)\n\n## What is KSQL\n\nKSQL is the streaming SQL engine for Apache Kafka.\n\n[What Is KSQL?](https://docs.confluent.io/current/ksql/docs/)\n\n\n## Install\n\nrequired \u003e= PHP 7.1\n\n```bash\n$ composer require ytake/php-ksql\n```\n\n## Usage\n\n### Request Preset\n\n| class |\n|-------------------------------------|\n| Ytake\\KsqlClient\\Query\\CommandStatus |\n| Ytake\\KsqlClient\\Query\\Status |\n| Ytake\\KsqlClient\\Query\\ServerInfo |\n| Ytake\\KsqlClient\\Query\\Ksql |\n| Ytake\\KsqlClient\\Query\\Stream (for stream) |\n\n[Syntax Reference](https://docs.confluent.io/current/ksql/docs/syntax-reference.html)\n\n### Get Command Status\n\n```php\n\u003c?php\n\nuse Ytake\\KsqlClient\\RestClient;\nuse Ytake\\KsqlClient\\Query\\CommandStatus;\nuse Ytake\\KsqlClient\\Computation\\CommandId;\n\n$client = new RestClient(\n    \"http://localhost:8088\"\n);\n$result = $client-\u003erequestQuery(\n    new CommandStatus(CommandId::fromString('stream/MESSAGE_STREAM/create'))\n)-\u003eresult();\n\n```\n\n### Get Statuses\n\n```php\n\u003c?php\n\nuse Ytake\\KsqlClient\\RestClient;\nuse Ytake\\KsqlClient\\Query\\Status;\n\n$client = new RestClient(\n    \"http://localhost:8088\"\n);\n$result = $client-\u003erequestQuery(new Status())-\u003eresult();\n\n```\n\n### Get KSQL Server Information\n\n```php\n\u003c?php\n\nuse Ytake\\KsqlClient\\RestClient;\nuse Ytake\\KsqlClient\\Query\\ServerInfo;\n\n$client = new RestClient(\n    \"http://localhost:8088\"\n);\n$result = $client-\u003erequestQuery(new ServerInfo())-\u003eresult();\n\n```\n\n### Query KSQL\n\n```php\n\u003c?php\n\nuse Ytake\\KsqlClient\\RestClient;\nuse Ytake\\KsqlClient\\Query\\Ksql;\n\n$client = new RestClient(\n    \"http://localhost:8088\"\n);\n$result = $client-\u003erequestQuery(\n    new Ksql('DESCRIBE users_original;')\n)-\u003eresult();\n\n```\n\n### Client for Stream Response\n\n```php\n\u003c?php\n\nuse Ytake\\KsqlClient\\StreamClient;\nuse Ytake\\KsqlClient\\Query\\Stream;\nuse Ytake\\KsqlClient\\StreamConsumable;\nuse Ytake\\KsqlClient\\Entity\\StreamedRow;\n\n$client = new StreamClient(\n    \"http://localhost:8088\"\n);\n$result = $client-\u003erequestQuery(\n    new Stream(\n        'SELECT * FROM testing',\n        new class() implements StreamConsumable {\n            public function __invoke(StreamedRow $row) \n            {\n                // stream response consumer\n            }\n        }    \n    )\n)-\u003eresult();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fytake%2Fphp-ksql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fytake%2Fphp-ksql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fytake%2Fphp-ksql/lists"}