Search by

webservco / application

ariademur

A PHP component/library. Interfaces for the application lifecycle (bootstrap, run, shutdown) and for the runner that does the work.

Package info

github.com/webservco/application

Homepage

pkg:composer/webservco/application

Statistics

Installs: 148

Dependents: 2

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.

Interfaces for the application lifecycle (bootstrap, run, shutdown) and for the runner that does the work.

  • Related: webservco/application-default (default application and its factories), webservco/application-runner (HTTP runner)

Installation

composer require webservco/application

Usage

An application goes through three steps. The entry point (public/index.php or a bin script) calls the first two, and the third usually runs as a shutdown function.

// \WebServCo\Application\Contract\ApplicationInterface
$application->bootstrap();
$application->run();
// $application->shutdown() is registered by the default implementation.

You rarely implement ApplicationInterface yourself. Use DefaultApplication from webservco/application-default, and give it an ApplicationRunnerInterface (HTTP) or a CommandRunnerInterface (CLI, from webservco/command).

Contracts

Interface Implementation Purpose
Contract\ApplicationInterface DefaultApplication (webservco/application-default) bootstrap(), run() and shutdown().
Contract\ApplicationRunnerInterface ApplicationRunner (webservco/application-runner) Does the work inside run(), for example handling an HTTP request.
Contract\ApplicationRunnerFactoryInterface ApplicationRunnerFactory (webservco/application-runner) Creates a runner for a PSR-7 server request.

Namespaces are relative to WebServCo\Application\.

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