PHPackages                             nih/http-kernel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. nih/http-kernel

ActiveLibrary[HTTP &amp; Networking](/categories/http)

nih/http-kernel
===============

Minimal HTTP kernel for PSR-7, PSR-11, PSR-15 and PSR-17 based applications.

0.1.4(1mo ago)352MITPHPPHP 8.4 - 8.5

Since Apr 11Pushed 1mo agoCompare

[ Source](https://github.com/nih-soft/http-kernel)[ Packagist](https://packagist.org/packages/nih/http-kernel)[ RSS](/packages/nih-http-kernel/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (10)Versions (6)Used By (2)

`nih/http-kernel`
=================

[](#nihhttp-kernel)

Minimal HTTP kernel for applications built around PSR-7, PSR-15 and PSR-17.

`nih/http-kernel` is for applications that want a thin, explicit HTTP runtime without adopting a full microframework. It uses NIH container/router packages by default and gives you ordered bootstraps, a main application pipeline, a separate error pipeline, and a safe deferred handoff model for post-response or legacy execution.

If you want a ready-to-run minimal application with conventional project layout around this kernel, start with [`nih/app-skeleton`](https://github.com/nih-soft/app-skeleton#readme). The examples below focus on the kernel-facing pieces.

Why use it
----------

[](#why-use-it)

- small application surface: `services`, `routes`, `pipeline`, `errorPipeline`, `fatal`
- boot-time configuration stays separate from request-time execution
- `errorPipeline` is independent from the normal application pipeline
- optional PSR-3 error logging through `ErrorLoggingMiddleware`
- built on focused packages: [`nih/container`](https://github.com/nih-soft/container#readme), [`nih/router`](https://github.com/nih-soft/router#readme), [`nih/middleware-dispatcher`](https://github.com/nih-soft/middleware-dispatcher#readme)
- supports post-response and legacy handoff through `DeferredCallableResponse`

When to choose it
-----------------

[](#when-to-choose-it)

Use this package when:

- you want your own PSR-based application skeleton instead of a full framework
- you need explicit control over bootstrap order, middleware composition, routing, and error rendering
- you want gradual migration from legacy code

This package is probably not the best fit when:

- you want a batteries-included microframework with a larger built-in ecosystem
- you prefer framework conventions over assembling your own application structure

Requirements
------------

[](#requirements)

- PHP `8.4 - 8.5`

Installation
------------

[](#installation)

```
composer require nih/http-kernel
```

If you want a ready-to-use starter project with a complete minimal application, see `nih/app-skeleton`.

If you need a legacy fallback when routing returns `NOT_FOUND`, see `nih/legacy-gateway`.

Quick start
-----------

[](#quick-start)

This example shows the smallest routed application. `GET /` dispatches `HomeAction`, and unmatched routes fall through to the default `NotFoundHandler` from `RoutingBootstrap`.

### `public/index.php`

[](#publicindexphp)

```
