PHPackages                             xoops/frame - 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. xoops/frame

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

xoops/frame
===========

XOOPS PSR-15 Middleware Dispatcher

v0.1.3(8y ago)3112GPL-2.0-or-laterPHPPHP &gt;7.1.0

Since Jan 27Pushed 8y ago1 watchersCompare

[ Source](https://github.com/XOOPS/Frame)[ Packagist](https://packagist.org/packages/xoops/frame)[ RSS](/packages/xoops-frame/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

Frame
=====

[](#frame)

Frame implements a simple [PSR-15 compatible](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-15-request-handlers.md) middleware dispatcher.

Frame is composer managed, so the easiest way to install it is to require `xoops/frame`.

[![Software License](https://camo.githubusercontent.com/69aa8ab9b70da98ede25a630986f6f140449c1e87f38be6c9aa800a813a39280/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE)[![Coverage Status](https://camo.githubusercontent.com/a2a6fb4b16ba8001ec40be27472f7de5e81cbe0704570ab37719b03e693d092e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f584f4f50532f4672616d652e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/XOOPS/Frame/code-structure)[![Quality Score](https://camo.githubusercontent.com/672fbe3d28784d4c65e6a6bd64e7965c13ef73136685b5c32ad8e0aa295e5065/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f584f4f50532f4672616d652e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/XOOPS/Frame)[![Latest Version](https://camo.githubusercontent.com/eb82f1695e7f2d553aa3cbea66dba6f8785e1740b039ff7e1f9d57590867a498/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f584f4f50532f4672616d652e7376673f7374796c653d666c6174)](https://github.com/XOOPS/Frame/releases)

Xoops/Frame/Rack
----------------

[](#xoopsframerack)

**Rack** is a middleware dispatcher. Instances of `Psr\Http\Server\MiddlewareInterface` can be added to the rack. After the desired middlewares have been added, it is dispatched by passing a `Psr\Http\Message\ServerRequestInterface` object to the rack run() method.

```
$rack = new \Xoops\Frame\Rack();
$rack->add($someMiddleware);
$rack->add($anotherMiddleware);
$response = $rack->run($request);
```

**Rack** will invoke each middleware in the order it was added. **Rack** will pass itself to each middleware as the `Psr\Http\Server\RequestHandlerInterface` *$handler* parameter, and when called as such will dispatch the next middleware in its queue.

The racked middleware is expected to ultimately return a `Psr\Http\Message\ResponseInterface`object, and as per PSR-15, it will be returned from the run() invocation.

As an alternative to the run() method, you can depend on the \_\_invoke() method to allow calling the **Rack** instance as a function.

```
$response = $rack($request);
```

A **Rack** instance is also a `Psr\Http\Server\MiddlewareInterface` object. This allows a **Rack** instance to be used as middleware, allowing a racks to be stacked.

Xoops/Frame/Exception
---------------------

[](#xoopsframeexception)

This namespace defines the following exceptions which can be thrown by **Rack**:

### InvalidHandlerException

[](#invalidhandlerexception)

This results from either trying to add a **Rack** instance to itself as middleware, or from forcinging something other than a valid `Psr\Http\Server\MiddlewareInterface` object to the middleware queue.

### RackExhaustedException

[](#rackexhaustedexception)

This exception results from attempting to advance past the end of the middleware queue. This condition indicates that no response message has been returned and there is no handler on the middleware queue to delegate response creation to.

Xoops\\Frame\\Panel
-------------------

[](#xoopsframepanel)

The `Panel` namespace contains several small *rack panels* that might be useful middleware in a duct tape sort of role.

### Blank

[](#blank)

`Blank` is just a placeholder. It does nothing other than delegate and return the response.

```
$rack->addToQueue(new Blank);

```

### ClosureToMiddleware

[](#closuretomiddleware)

`ClosureToMiddleware` lets you build middleware from a [PHP Closure](http://php.net/manual/en/class.closure.php) or [anonymous function](http://php.net/manual/en/functions.anonymous.php).

```
$callable = function (RequestInterface $request, RequestHandlerInterface $handler) {
    $response = $handler->handle($request);
    $modifiedResponse = $response->withHeader('X-Powered-By', 'black coffee');
    return $modifiedResponse;
};
$middleware = new ClosureToMiddleware($callable);

$rack->add($middleware);
```

### FixedResponse

[](#fixedresponse)

`FixedResponse` returns the `Psr\Http\Message\ResponseInterface` passed to it at instantiation.

```
$response = $myResponseFactory->createResponse(200);
$rack->add(new FixedResponse($response));

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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 ~2 days

Total

4

Last Release

3019d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7eb0c56896d2405e44608ffb77c1411e4a18927be440b28275f7e0cb075ea9d6?d=identicon)[geekwright](/maintainers/geekwright)

---

Top Contributors

[![geekwright](https://avatars.githubusercontent.com/u/3181636?v=4)](https://github.com/geekwright "geekwright (10 commits)")

---

Tags

psr-7middlewarepsr-15

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/xoops-frame/health.svg)

```
[![Health](https://phpackages.com/badges/xoops-frame/health.svg)](https://phpackages.com/packages/xoops-frame)
```

###  Alternatives

[relay/relay

A PSR-15 server request handler.

3302.1M86](/packages/relay-relay)[mezzio/mezzio-authentication

Authentication middleware for Mezzio and PSR-7 applications

121.6M26](/packages/mezzio-mezzio-authentication)[jimtools/jwt-auth

PSR-15 JWT Authentication middleware, A replacement for tuupola/slim-jwt-auth

20142.3k3](/packages/jimtools-jwt-auth)[tkhamez/slim-role-auth

Role-based authorization for the Slim framework

1410.2k](/packages/tkhamez-slim-role-auth)[segrax/open-policy-agent

Open Policy Agent client and PSR-7, PSR-15 Authorization Middleware

212.0k](/packages/segrax-open-policy-agent)

PHPackages © 2026

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