Download the PHP package ziffmedia/laravel-ksql without Composer

On this page you can find all versions of the php package ziffmedia/laravel-ksql. 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 laravel-ksql

Laravel KSQL

A Laravel-focused client for KsqlDB's REST api. This package is designed to integrate tightly with laravel but does not strictly require it. The core KSQL client only depends on symfony/http-client.

Requirements

Installation

Install the package via composer: composer require ziffmedia/laravel-ksql

Publish the ksql.php config file: php artisan vendor:publish --provider "ZiffMedia\LaravelKsql\KsqlServiceProvider"

Usage

Construct a basic KSQL client by hand:

Construct a basic KSQL client by hand, with HTTP basic authentication:

Note: if using Confluent Cloud, the username and password should be a KSQL api key and api secret, respectively.

Use the Laravel DI container to factory a client based on config values:

Config file and environment variables

The KsqlQueryResult Class

All queries (streaming or otherwise) will return an instance of Ziffmedia\LaravelKsql\Ksql\QueryResult. This class is a value object that contains the following public properies:

The KsqlStreamChanged Event

This class is a Laravel-native event. It contains one public property, which is the QueryResult object that caused that event to be emitted. You can listen to this event in your Laravel application, and add business logic based on the contents of the QueryResult. For more granular control, you can subclass this event to enable queueing and more control over discrete listening for result types when multiplexing or using the ksql-consumer command. Any method that allows emitting of events in the client will take an optional classname to use for the event emitted.

Non-streaming queries

Streaming queries

Querying a single stream (query ends in "EMIT CHANGES") has the same basic functionality as the ->query() method, with the exception that the ->stream() method is intended to be used exclusively in a command-line context for a long-running process. ->stream() will not return unless it is either disconnected at the network level or receives an EOF from the KsqlDB HTTP server.

Multiplexing multiple streaming queries

You'll often want to actually use HTTP/2 connection pooling to multiplex multiple streaming queries at once. Use the ->multiplex() method to return a stream multiplexer object, which can be "built up" with multiple query calls, before calling ->sream() to start streaming.

For multiplexed queries, each ->query() call supports the same options as a single stream query, including event emitting events, using callable row handlers, etc. Each call to ->query() has an additional leading argument that is a "name key" for that query. This is used both internally to identify which stream data is coming from and also returned back to your in QueryResult instances.

Using the built-in consumer command

This package provides a convenience artisan command that can read your config/ksql.php for a list of stream queries to multiple and emit events to your application. This encompasses a common use case of needing to query a stream and have a hook to perform application logic as that stream changes. Simple create an event listener in your Laravel app and run artisan ksql-consumer and your listener will be triggered as data flows through the KSQL streams (or tables).

The config file syntax also provides a facility to specify custom event classes per-query, though it does not allow for the use of a callable row handler. If you require a row handler instead of an event listener (uncommon), you'll need to use the above client examples to create your own tooling.


All versions of laravel-ksql with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ziffmedia/ksql Version ^0.4
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 ziffmedia/laravel-ksql contains the following files

Loading the files please wait ....