Download the PHP package maniaba/codeigniter4-sse without Composer

On this page you can find all versions of the php package maniaba/codeigniter4-sse. 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 codeigniter4-sse

CodeIgniter SSE

PHPUnit PHPStan Docs Coverage Status

PHP CodeIgniter

CodeIgniter SSE is a lightweight, powerful Server-Sent Events library for CodeIgniter 4. It provides a clean, framework-native API for building real-time features with one-way event streams over HTTP.

Use it for notifications, progress updates, activity feeds, logs, live dashboards, and other event-driven UI updates. Application code publishes semantic events through one CI4 service, while the selected broker adapter handles Redis or Mercure delivery, browser streaming, and reconnect behavior.

The public API stays independent of the transport. Start with Redis for simple deployments, switch to Mercure when long-lived browser connections should move out of PHP, and keep the same sse()->publish(...) application code.

Requirements

Installation

Install the package:

Ensure that Redis is reachable:

The package speaks RESP2 over PHP stream sockets. It does not require PhpRedis, Predis, or another Redis client package. The PHP JSON extension is required.

Package routes, services, and Spark commands are discovered through CodeIgniter's Composer package discovery. See Installation when discovery is restricted in your application.

Quick start

Publish an event from a controller, domain service, listener, command, or queue worker:

Open the stream for one or more logical channels:

Use the included framework-independent ES module:

SseClient opens EventSource through the selected frontend adapter. When the server broker changes, update the adapter class in the browser client.

The browser's native EventSource automatically reconnects when a connection ends. With Redis, the package intentionally limits the PHP stream lifetime. With Mercure, the browser streams directly from the Hub.

Channel security

The built-in authorization policy permits only channels under public.*. Every user, tenant, order, project, or other private channel is denied until the application provides a ChannelAuthorizerInterface implementation.

Register a matching UserResolverInterface when the application uses session, Shield, JWT, or another authentication system. Channel names supplied by the browser are logical names; clients never receive or control the internal Redis prefix. In production, private SSE routes should also use application authentication and per-user rate/concurrency filters to control open streams and reconnect churn; filters do not replace per-channel authorization.

See Channels and authorization for the complete setup.

Configuration

Create app/Config/Sse.php when defaults need to be changed:

Redis connection details and scalar package options can be supplied through .env. The exact options and production recommendations are documented under Configuration.

Redis is the default broker and the easiest starting point. It uses Redis Pub/Sub while CodeIgniter holds the browser's SSE response open from /sse. For larger environments or applications with many concurrent users, prefer Mercure: PHP handles short authorization and publish requests, while the Hub owns the long-lived browser connections.

Delivery semantics

The first release deliberately uses raw Redis Pub/Sub:

Use a database, queue, or a future durable broker adapter when an event must not be lost. Redis Streams and Last-Event-ID replay are outside the Pub/Sub contract. Redis Pub/Sub is not isolated by numbered Redis databases, so every application must use its own channelPrefix.

Mercure is available when long-lived streams should not occupy PHP workers:

Publishing remains unchanged. The /sse route becomes a short channel authorization request that sets a topic-scoped HttpOnly JWT cookie, and the browser client connects directly to the Hub:

Use the frontend adapter that matches the configured broker. Mercure's adapter authorizes through the package route and then opens EventSource on the Hub.

Mercure can replay retained Hub history through Last-Event-ID. See Mercure Hub for Docker, signing keys, authorization, cookies, CORS, and reverse-proxy configuration.

Documentation

Testing

Redis integration tests require a reachable test Redis instance and use a dedicated prefix. See Testing.

License

CodeIgniter SSE is released under the MIT License. CodeIgniter-derived portions retain their notices in Third-party notices.


All versions of codeigniter4-sse with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
codeigniter4/framework Version ^4.7
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 maniaba/codeigniter4-sse contains the following files

Loading the files please wait ...