Download the PHP package componenta/http-emitter without Composer

On this page you can find all versions of the php package componenta/http-emitter. 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 http-emitter

Componenta HTTP Emitter

PSR-7 response emitter for Componenta HTTP applications. It sends status, headers, and body content to PHP output.

Use this package at the outer HTTP entry point after the PSR-15 pipeline has produced a ResponseInterface.

Boundary

This package only emits an already built response. It does not build responses, create server requests, or run middleware. Use componenta/http-responder for response creation and componenta/app-http for the HTTP runtime pipeline.

Installation

Componenta\Http\EmitterConfigProvider is exposed through Composer metadata.

Public API

EmitterInterface::emit(ResponseInterface $response): void emits a response. Emitter is the default implementation.

Emitter accepts an optional chunk size:

EmitStrategy controls body emission:

Case Meaning
Full Emit the full response body.
Partial Emit a range response body.
NoBody Emit headers without a body.

EmitterException is thrown for emitter-level failures.

Runtime Behavior

Before emitting, Emitter checks that headers have not already been sent and clears active output buffers. Then it chooses a strategy from the response status and headers:

Strategy When it is used
NoBody Informational statuses, 204, 205, or 304.
Partial Status 206 with a Content-Range header.
Full All other responses.

For full responses, the emitter adds Content-Length when the stream is seekable, its size is known, and both Content-Length and Transfer-Encoding are absent. For non-seekable streams it sends the remaining body without inferring its length from the total stream size. For seekable streams with known size it also adds Accept-Ranges: bytes. Bodies are streamed in chunks and stop early if the client disconnects.

For partial responses, the emitter sends the body already prepared by the response producer and preserves Content-Range. Responses with status 416 retain their explanatory body. Responses with status 304 retain Content-Location while emitting no body.

Configuration

The config provider registers Emitter and aliases EmitterInterface to it. Applications normally receive the emitter from the container.

Tests

Run composer test. HTTP header tests use php-cgi beside the active PHP executable; set PHP_CGI_BINARY when it is installed elsewhere. These tests are skipped if CGI is unavailable, so install CGI in CI to verify response headers as well as bodies.

Related Packages


All versions of http-emitter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
componenta/config Version ^3.0.0
psr/http-message Version ^2.0
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 componenta/http-emitter contains the following files

Loading the files please wait ...