PHPackages                             wordpress-psr/request-handler - 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. [API Development](/categories/api)
4. /
5. wordpress-psr/request-handler

ActiveLibrary[API Development](/categories/api)

wordpress-psr/request-handler
=============================

A PSR-15 server request handler for WordPress.

315795[4 issues](https://github.com/WordPress-PSR/request-handler/issues)PHPCI passing

Since Mar 27Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/WordPress-PSR/request-handler)[ Packagist](https://packagist.org/packages/wordpress-psr/request-handler)[ RSS](/packages/wordpress-psr-request-handler/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (6)Used By (0)

WordPress Request Handler
=========================

[](#wordpress-request-handler)

A [PSR-15](https://www.php-fig.org/psr/psr-15/) Request Handler wrapper around WordPress core.

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

[](#installation)

```
$ composer require wordpress-psr/request-handler
```

Overview
--------

[](#overview)

This package allows WordPress installations to be used in a PSR Request and Response context. This package is not very useful by itself but can be combined with any number of [Request Handler Runners](https://github.com/laminas/laminas-httphandlerrunner/) or [Middlewares](https://github.com/middlewares/psr15-middlewares)to use WordPress is ways which were never possible before.

Swoole
------

[](#swoole)

Using this request handler and combining it with the [chubbyphp-swoole-request-handler](https://github.com/chubbyphp/chubbyphp-swoole-request-handler)it is possible to run WordPress in the persistent, high performance, event-driven, asynchronous swoole http server. See the [WordPress PSR Swoole project](https://github.com/WordPress-PSR/swoole) for more details. In addition to Swoole since this request handler is using the psr-15 standard other event driven libraries such as [react](https://reactphp.org/) or [amp](https://amphp.org/http-server/classes/middleware) should work as well.

Example Usage
-------------

[](#example-usage)

See tests/server.php for a working example of how this request handler could be used. This file was used to test the request handler with this line in the nginx conf:

```
try_files $uri /wordpress/$uri /tests/server.php?$args;

```

which is needed so static files in the wordpress sub-folder can be accessed and anything else is handled by server.php.

WordPress Modifications
-----------------------

[](#wordpress-modifications)

WordPress core code needed to be modified to get certain aspects of the request handler to work. These are kept in a [fork](https://github.com/superdav42/wordpress-core) right now but hopefully after their usefulness has been proven the changes can be merged into core. Rector was used to make some modifications such as changing all called to `exit` or `die` to a new function called `wp_exit`. `wp_exit()` just does the action `wp_exit` before calling exit so that this request handler can throw an exception which return the execution flow to the request handler which returns a response object instead of exiting.
All calls to `header()` and `setcookie` were also changed to trigger an action that this request handler hooks onto. The hook records the headers and cookies so they can be added to the response object. Other changes are performed to allow WordPress to work as a long-running process. Mostly using `require` instead of `require_once` where appropriate.

License
-------

[](#license)

GPL, see LICENSE.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance57

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8732cbed108269761a740f7b8c63bbf7eef3c927c7b1cf2554c0f87943f335d9?d=identicon)[superdav42](/maintainers/superdav42)

---

Top Contributors

[![superdav42](https://avatars.githubusercontent.com/u/1534605?v=4)](https://github.com/superdav42 "superdav42 (34 commits)")

### Embed Badge

![Health badge](/badges/wordpress-psr-request-handler/health.svg)

```
[![Health](https://phpackages.com/badges/wordpress-psr-request-handler/health.svg)](https://phpackages.com/packages/wordpress-psr-request-handler)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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