Search by

webservco / application-runner

ariademur

A PHP component/library. Runs a PSR-15 request handler for the current request and sends the response to the client.

Package info

github.com/webservco/application-runner

Homepage

pkg:composer/webservco/application-runner

Statistics

Installs: 49

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v2.3.0 2026-10-11 16:34 UTC

This package is auto-updated.

Last update: 2026-10-11 16:45:40 UTC


README

A PHP component/library. Please see webservco/sandbox for an example project using these types of components.

Runs a PSR-15 request handler for the current request and sends the response to the client.

  • Related: webservco/application-default (uses the runner), webservco/emitter (sends the response), webservco/http-request-handler (the request handler)

Installation

composer require webservco/application-runner

Usage

Give the factory something that builds your request handler (the middleware stack). The server application factory in webservco/application-default then asks it for a runner.

use WebServCo\Application\Factory\ApplicationRunnerFactory;

$runnerFactory = new ApplicationRunnerFactory(
    // \WebServCo\Http\Contract\Message\Request\RequestHandler\RequestHandlerFactoryInterface
    $requestHandlerFactory,
);

// \WebServCo\Application\Contract\ApplicationRunnerInterface
$runner = $runnerFactory->createApplicationRunner($serverRequest);
$runner->run();

run() passes the request to the handler, then emits the response through a StackEmitter that contains a SapiEmitter.

Contracts

Interface Implementation Purpose
Contract\ApplicationRunnerFactoryInterface (webservco/application) Factory\ApplicationRunnerFactory Creates a runner for a server request.
Contract\ApplicationRunnerInterface (webservco/application) Service\ApplicationRunner Handles the request and emits the response.

Namespaces are relative to WebServCo\Application\.

Notes

The runner is for web requests only. In CLI, SapiEmitter refuses to emit and the emitter stack throws an UnderflowException. Use a command runner (webservco/command) for scripts.

Development

# Start project.
ddev start
# Install dependencies.
ddev c u
# Run all validations.
ddev c c
# Run unit tests.
ddev c test:dox

License

MIT