PHPackages                             northwoods/lazy-middleware - 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. northwoods/lazy-middleware

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

northwoods/lazy-middleware
==========================

Lazy loading for middleware and request handlers

2.0.0(6y ago)5204.7k2MITPHPPHP ^7.2

Since Oct 17Pushed 6y ago2 watchersCompare

[ Source](https://github.com/northwoods/lazy-middleware)[ Packagist](https://packagist.org/packages/northwoods/lazy-middleware)[ RSS](/packages/northwoods-lazy-middleware/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (8)Versions (5)Used By (0)

Northwoods Lazy Middleware
==========================

[](#northwoods-lazy-middleware)

[![Build Status](https://camo.githubusercontent.com/85a7b420b35aa4c95519d5539e1f97a046aae7fbba4c232ed6d4032dc8f20716/68747470733a2f2f7472617669732d63692e636f6d2f6e6f727468776f6f64732f6c617a792d6d6964646c65776172652e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/northwoods/lazy-middleware)[![Code Quality](https://camo.githubusercontent.com/c593577c890bcb9ada61078577c0250c3660df605cc9c72ab107d6f6f26895ab/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e6f727468776f6f64732f6c617a792d6d6964646c65776172652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/northwoods/lazy-middleware/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/37282aa03904e9615f8e3b9c6f565dbdb4854c2e9ce9ddfd4120be9f3268169d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e6f727468776f6f64732f6c617a792d6d6964646c65776172652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/northwoods/lazy-middleware/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/658d428d7ae06e12e316eb4d47a85507e0e7d6795c5437afe51e8096af1ecf0f/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f727468776f6f64732f6c617a792d6d6964646c65776172652e7376673f7374796c653d666c6174)](https://packagist.org/packages/northwoods/lazy-middleware)[![Total Downloads](https://camo.githubusercontent.com/6c91892a602a1a59a5282e57ede076b718cd18df776955c53ffb57325c738e75/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f727468776f6f64732f6c617a792d6d6964646c65776172652e7376673f7374796c653d666c6174)](https://packagist.org/packages/northwoods/lazy-middleware)[![License](https://camo.githubusercontent.com/1c0dd558e52d2e3339c63fad97020b479815458d7d9d439ffb245d02cdbf1e80/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6f727468776f6f64732f6c617a792d6d6964646c65776172652e7376673f7374796c653d666c6174)](https://packagist.org/packages/northwoods/lazy-middleware)

Lazy loading for [PSR-15 middleware and request handlers](https://www.php-fig.org/psr/psr-15/) that supports "just in time" instantiation using a [PSR-11](https://www.php-fig.org/psr/psr-11/) [container](https://packagist.org/providers/psr/container-implementation).

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

[](#installation)

The best way to install and use this package is with [composer](http://getcomposer.org/):

```
composer require northwoods/lazy-middleware
```

Usage
-----

[](#usage)

This package contains two factories: one for request handlers and one for middleware.

### LazyHandlerFactory::defer($handler)

[](#lazyhandlerfactorydeferhandler)

Create a new lazy handler.

The `$handler` identifier is *not* required to be a class name. Any string that refers to a container identifier can be used.

```
use Northwoods\Middleware\LazyHandlerFactory;

/** @var ContainerInterface */
$container = /* any container */;

$lazyHandler = new LazyHandlerFactory($container);

/** @var \Psr\Http\Server\RequestHandlerInterface */
$handler = $lazyHandler->defer(Acme\FooHandler::class);
```

### LazyMiddlewareFactory::defer($middleware)

[](#lazymiddlewarefactorydefermiddleware)

Create a new lazy middleware.

The `$middleware` identifier is *not* required to be a class name. Any string that refers to a container identifier can be used.

```
use Northwoods\Middleware\LazyMiddlewareFactory;

/** @var ContainerInterface */
$container = /* any container */;

$lazyMiddleware = new LazyMiddlewareFactory($container);

/** @var \Psr\Http\Server\MiddlewareInterface */
$middleware = $lazyMiddleware->defer(Acme\BarMiddleware::class);
```

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~99 days

Total

4

Last Release

2509d ago

Major Versions

1.1.1 → 2.0.02019-08-10

PHP version history (2 changes)1.0.0PHP ^7.1

2.0.0PHP ^7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38203?v=4)[Woody Gilk](/maintainers/shadowhand)[@shadowhand](https://github.com/shadowhand)

---

Top Contributors

[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (17 commits)")

---

Tags

containerhandlerlazymiddlewarepsr-11psr-15requesthttprequestmiddlewarecontainerproxyhandlerpsr-15lazy

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/northwoods-lazy-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/northwoods-lazy-middleware/health.svg)](https://phpackages.com/packages/northwoods-lazy-middleware)
```

###  Alternatives

[mezzio/mezzio

PSR-15 Middleware Microframework

3903.8M120](/packages/mezzio-mezzio)[middlewares/request-handler

Middleware to execute request handlers

451.7M28](/packages/middlewares-request-handler)[psr/http-server-handler

Common interface for HTTP server-side request handler

178109.8M1.1k](/packages/psr-http-server-handler)[psr/http-server-middleware

Common interface for HTTP server-side middleware

18399.3M1.8k](/packages/psr-http-server-middleware)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28545.4k3](/packages/mezzio-mezzio-authentication-oauth2)[laminas/laminas-stratigility

PSR-7 middleware foundation for building and dispatching middleware pipelines

577.0M95](/packages/laminas-laminas-stratigility)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
