{"id":25524846,"url":"https://github.com/seanmorris/ksqlc","last_synced_at":"2025-10-28T16:03:49.995Z","repository":{"id":53740092,"uuid":"264541336","full_name":"seanmorris/ksqlc","owner":"seanmorris","description":"The Asynchronous PHP KSQL Connector","archived":false,"fork":false,"pushed_at":"2024-02-25T15:41:54.000Z","size":916,"stargazers_count":13,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-10T22:30:38.346Z","etag":null,"topics":["async","kafka","ksql","ksqldb","php","php7","php8","streaming"],"latest_commit_sha":null,"homepage":"http://docs.ksqlc.seanmorr.is","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seanmorris.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,"zenodo":null}},"created_at":"2020-05-16T22:44:38.000Z","updated_at":"2025-06-06T18:06:50.000Z","dependencies_parsed_at":"2025-04-11T03:42:59.872Z","dependency_job_id":"01716403-94df-4373-8a9b-9d7865d567f8","html_url":"https://github.com/seanmorris/ksqlc","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/seanmorris/ksqlc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmorris%2Fksqlc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmorris%2Fksqlc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmorris%2Fksqlc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmorris%2Fksqlc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seanmorris","download_url":"https://codeload.github.com/seanmorris/ksqlc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanmorris%2Fksqlc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281467293,"owners_count":26506464,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["async","kafka","ksql","ksqldb","php","php7","php8","streaming"],"created_at":"2025-02-19T20:16:28.365Z","updated_at":"2025-10-28T16:03:49.898Z","avatar_url":"https://github.com/seanmorris.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![avatar](https://avatars3.githubusercontent.com/u/640101?s=80\u0026v=4)\n\n# SeanMorris/Ksqlc\n\n/*keɪ ɛs kyu ɛl si*/ • The Asynchronous PHP KSQL Connector\n\nKsqlc provides a PHP interface to Confluent KSQL \u0026 Apache Kafka.\n\nKsqlc is free for distribution, modification, and use under the [Apache-2.0 license](https://raw.githubusercontent.com/seanmorris/ksqlc/master/LICENSE).\n\n[Docs](http://ksqlc.seanmorr.is/) | [Github](http://github.com/seanmorris/ksqlc) | [Packagist](https://packagist.org/packages/seanmorris/ksqlc)\n\n[![seanmorris/ksqlc](https://img.shields.io/packagist/v/seanmorris/ksqlc?color=900\u0026label=seanmorris%2Fksqlc\u0026logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAACA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jSBMoFGs2aJ54Rxva0kcGMdmG4eqz0OdJbqlBLWpSW45iU06Sf606MXK0OFV1y5SHdFWa8Kuw4k7fTKMRH%2Fegy5QBQ%2B4%2BmZX8vFwYTqRJ6LUaOapFmp%2FShrb0kYL4dEDso9KqFpzkpga1qCnF8dw%2F1K748O82Z79WWq5Vf2suOYXf91ZZMX2RPSAEevD55Qpcqy%2FASE0JjFpRgmoDwTWf8R1taCt96EsOcpGT3NSg1nPac29umDSW13NUX5kMOvxjpA5%2Fu1SDvw6%2Bgy%2BumnHbUikylIrL5Vp8NdZAcM1nfEcb2tJH%2BpKDXOScpfWi61p5blWD4QRSj6uhVkuImquRf0KN0TIN%2FnvdDHzYQXDNZ3xHG5u99CUHuRY5enVoDzbdMGnxcLzFyp0Q9wQeiDn%2Bj9i1rckIrvmM72hjs6cvOcjlcAD1xxM3XTdmdf2x5Q3OND9EVn4PCNaYjcjTk%2BCaz2zvaUsf%2BpKDXA5I22t0%2FvBPNoiRmbjXY3r6YOAtcXpVLAi0pQ99yfEcp%2BNBtKoPOIkD47EAHMRj%2Br5I%2FH8NrWvzntWI2gAAAABJRU5ErkJggg%3D%3D\u0026style=for-the-badge)](http://finalbossoftheinternet.com/) [![Apache-2.0 Licence Badge](https://img.shields.io/github/license/seanmorris/ksqlc?color=338800\u0026logo=apache\u0026style=for-the-badge)](https://github.com/seanmorris/ksqlc/blob/master/LICENSE) [![CircleCI](https://img.shields.io/circleci/build/github/seanmorris/ksqlc?logo=circleci\u0026logoColor=white\u0026style=for-the-badge)](https://circleci.com/gh/seanmorris/ksqlc/) [![Size badge](https://img.shields.io/github/languages/code-size/seanmorris/ksqlc?logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAQAAACFzfR7AAABF0lEQVQoFQXBQWvOAQDA4ef/7o29YWtqKU7ExWE5OIvm4LKcnXwD7aQ0N/kAczO1i1KOO0xJvQojaTm4KbJabnJysLSf5wFAa603CUB322yOAAitVT86BTTQ1+oJDYDQcv+qFRr3vC1ooYPqDkHoYgfVKmnSfhG62t/qBkHn2q8ekjRpryB0v/rZ2eh4r6tpY5pp3Gx7RTONoJfVLnpQfekYtNG0832rRj3tEaT31bOxQ5wc/oATrnnniEMfXfaZDFrAoEk71XajNN9OVVW7HYVeVZ9AF/pd3YPm267qbYs0tF597wygpaquQ7Nt9QLoVlWXCEK3q1oCCF2p6iYBpKGN6kNzATrdr2qVAACa9rgRQKPetAnAf1jX/qSkN8aIAAAAAElFTkSuQmCC\u0026style=for-the-badge)](https://github.com/seanmorris/ksqlc) [![Installs](https://img.shields.io/packagist/dt/seanmorris/ksqlc?color=338800\u0026label=installs\u0026logo=data:image/svg+xml;base64,PHN2ZyBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyOS45NzggMjkuOTc4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOS45NzggMjkuOTc4IiB2ZXJzaW9uPSIxLjEiIHk9IjBweCIgeD0iMHB4Ij48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJtMjUuNDYyIDE5LjEwNXY2Ljg0OGgtMjAuOTQ3di02Ljg0OGgtNC4wMjZ2OC44NjFjMCAxLjExMSAwLjkgMi4wMTIgMi4wMTYgMi4wMTJoMjQuOTY3YzEuMTE1IDAgMi4wMTYtMC45IDIuMDE2LTIuMDEydi04Ljg2MXoiLz48cGF0aCBkPSJtMTQuNjIgMTguNDI2LTUuNzY0LTYuOTY1cy0wLjg3Ny0wLjgyOCAwLjA3NC0wLjgyOGgzLjI0OHYtMS40MTYtOC43MjNzLTAuMTI5LTAuNDk0IDAuNjE1LTAuNDk0aDQuNTcyYzAuNTM2IDAgMC41MjQgMC40MTYgMC41MjQgMC40MTZ2OC43NDIgMS4yNjZoMi45OThjMS4xNTQgMCAwLjI4NSAwLjg2NyAwLjI4NSAwLjg2N3MtNC45MDQgNi41MS01LjU4OCA3LjE5M2MtMC40OTIgMC40OTUtMC45NjQtMC4wNTgtMC45NjQtMC4wNTh6Ii8+PC9nPjwvc3ZnPgo=\u0026style=for-the-badge)](https://packagist.org/packages/seanmorris/ksqlc) [![Coverage](https://img.shields.io/codecov/c/github/seanmorris/ksqlc?logo=codecov\u0026logoColor=white\u0026style=for-the-badge)](https://codecov.io/gh/seanmorris/ksqlc) [![Min Supported PHP Version](https://img.shields.io/packagist/php-v/seanmorris/ksqlc?color=purple\u0026logo=php\u0026logoColor=white\u0026style=for-the-badge)](https://app.circleci.com/pipelines/github/seanmorris/ksqlc?branch=master)\n\n### Supports PHP 7.0 - PHP 8.3!\n\n## Installation\n\nInstall via the [composer cli](https://getcomposer.org/doc/03-cli.md#require):\n\n```sh\n\n$ composer require seanmorris/ksqlc\n\n```\n\n... or add `seanmorris/ksqlc` to your [`composer.json`](https://getcomposer.org/doc/01-basic-usage.md#composer-json-project-setup):\n\n```json\n\t\"require\": {\n\t\t\"seanmorris/ksqlc\": \"dev-master\"\n\t}\n```\n\n## Usage\n\n#### Open a connection\n\nGrab the URL to your KSQL server's REST endpoint, and use it to create a new `Ksqlc` object to begin:\n\n```php\n\u003c?php\nuse \\SeanMorris\\Ksqlc\\Ksqlc;\n\n$ksqlc = new Ksqlc('http://your-ksql-server:8088/');\n\n```\n\n### Ksqlc::stream() - Stream Queries Asynchronously\n\nKSQLDB will push query results to you asynchronously when you're using `Ksqlc::stream()`.\n\nKsqlc will return streaming queries as generators. These can be iterated with `foreach`. Results will stream in until a limit is reached or the programmer breaks the loop  and destroys the reference.\n\n```php\n\u003c?php\n$stream = $ksqlc-\u003estream('SELECT * FROM EVENT_STREAM EMIT CHANGES');\n\nforeach($stream as $row)\n{\n\t// $row == {\"ROWKEY\": \"XXX\", \"ROWTIME\": \"YYY\", ...}\n\tif($row-\u003eproperty === 'something')\n\t{\n\t\tbreak;\n\t}\n}\n\nunset($stream);\n\n```\n\n### Ksqlc::multiplex() - Stream Mutliple Queries\n\nYou can loop over multiple queries at once with `Ksqlc::multiplex()`. Each parameter to this method represents either a string query or a list of parameters to send to `Ksqlc::stream()`.\n\n```php\n\u003c?php\n$queryOne = 'SELECT * FROM EVENTS WHERE BODY = \"AAA\" EMIT CHANGES LIMIT 20';\n$queryTwo = 'SELECT * FROM STREAM WHERE BODY = \"BBB\" EMIT CHANGES LIMIT 20';\n\n$stream = $ksqlc-\u003emultiplex(\n\t[$queryOne, 'earliest'],\n\t[$queryTwo, 'earliest']\n);\n\nforeach($stream as $row)\n{\n\t/* Stream processing... */\n}\n```\n\n#### Limits\n\nQueries with limits will terminate when the given number of rows have been iterated.\n\nMultiplexed queries will terminate when all limits have been reached.\n\n```php\n\u003c?php\n$stream = $ksqlc-\u003estream('SELECT * FROM EVENT_STREAM EMIT CHANGES LIMIT 20');\n\nforeach($stream as $row)\n{\n\t/* Stream processing... */\n}\n```\n\n#### Offset Reset\n\nStreaming queries will **ONLY** select new records by default. Use the second param to `Ksqlc::stream()` to process all records from the beginning of time.\n\n```php\n\u003c?php\n$stream = $ksqlc-\u003estream($queryString, 'earliest'); ## process everything\n$stream = $ksqlc-\u003estream($queryString, 'latest');   ## process new records\n```\n\n#### Full asyncronicity\n\nPassing `TRUE` to the third parameter of `Ksqlc::stream()` allows you to turn on full asyncronous mode.\n\nIn this example, the foreach loop will spin indefinitely until the query returns 20 records and completes. If there is no data to process, a stream of `NULL`'s will be supplied. This allows you to tend to other, unrelated streams in the same loop, or even break the loop and resume processing later on.\n\n```php\n\u003c?php\n$query  = 'SELECT * FROM EVENT_STREAM EMIT CHANGES LIMIT 20';\n$stream = $ksqlc-\u003estream($queryString, 'latest', TRUE);\n\nforeach($stream as $row)\n{\n\tvar_dump($row);\n}\n```\n\n### Ksqlc::run() - Run a KSQL statment\n\nYou'll do things like create or drop tables and streams with this method. Any statement that isnt a direct `SELECT` should be passed to `Ksqlc::run()`.\n\nKsqlc::run will return an iterable object of results with metadata properties:\n\n```php\n\u003c?php\n$results = $ksqlc-\u003erun('SHOW TABLES');\nvar_dump( $results );\n// object SeanMorris\\Ksqlc\\Result {\n//  $type          =\u003e \"tables\"\n//  $warnings      =\u003e {}\n//  $statementText =\u003e \"SHOW TABLES\"\n// }\n\nforeach($results as $table)\n{\n\tvar_dump( $table );\n\t// object stdClass {\n\t// \t$type       =\u003e \"TABLE\"\n\t// \t$name       =\u003e \"event_table\"\n\t// \t$topic      =\u003e \"event_table\"\n\t// \t$format     =\u003e \"JSON\"\n\t// \t$isWindowed =\u003e false\n\t// }\n}\n```\n\nYou can also use list destructuring to get the results of multiple queries all at once:\n\n```php\n\u003c?php\n[$streams, $tables] = $ksqlc-\u003erun('SHOW STREAMS', 'SHOW TABLES');\n\nforeach($streams as $stream)\n{\n\t// ...\n}\n\nforeach($tables as $table)\n{\n\t// ...\n}\n\n```\n\n### SeanMorris/Ksqlc\n\nCopyright 2020 - 2024 Sean Morris\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n* http://www.apache.org/licenses/LICENSE-2.0\n* https://raw.githubusercontent.com/seanmorris/ksqlc/master/LICENSE\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanmorris%2Fksqlc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanmorris%2Fksqlc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanmorris%2Fksqlc/lists"}