PHPackages                             duncanjbrown/plain-route - 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. duncanjbrown/plain-route

ActiveLibrary[API Development](/categories/api)

duncanjbrown/plain-route
========================

Define arbitrary endpoints in WordPress

0.1(10y ago)11.2k↓77.8%1MITPHPPHP &gt;=5.3.0

Since Jan 18Pushed 10y agoCompare

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

READMEChangelogDependenciesVersions (2)Used By (1)

Purpose
=======

[](#purpose)

This library provides a simple interface for WordPress's fiddly rewrite rules API.

It's useful for creating arbitrary endpoints with callbacks. For example, a webhook receiver for a payment gateway.

Usage
=====

[](#usage)

Creating an endpoint is accomplished by `new`ing one up. You should do this on `init`.

```
add_action( 'init', function() {
  new Plain_Route( 'stripe(/)?', [
    'rewrite' => 'p=123',
    'pre_get_posts' => function( $query ) {
    if( $query->is_main_query() ) {
      $query->set('stripe', true);
    }
  }]);
});

```

In the above example, `pre_get_posts` could be replaced with `wp_title` or `wp`. Or you could add them alongside.

You can also render any template with the special `template` callback.

Creating an endpoint that renders a specific template:

```
add_action( 'init', function() {
 	new Plain_Route( 'my-special-template(/)?', [
 		'template' => 'my-special-template.php'
 	]);
});

```

Credit
======

[](#credit)

This class is a much-simplified variation of HM\_Rewrite by humanmade.

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

3809d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b231ee91714983bf9d76f540e53f27e8362cc58dbb5aa2551b950548622ff50?d=identicon)[duncanjbrown](/maintainers/duncanjbrown)

---

Top Contributors

[![duncanjbrown](https://avatars.githubusercontent.com/u/642279?v=4)](https://github.com/duncanjbrown "duncanjbrown (2 commits)")

### Embed Badge

![Health badge](/badges/duncanjbrown-plain-route/health.svg)

```
[![Health](https://phpackages.com/badges/duncanjbrown-plain-route/health.svg)](https://phpackages.com/packages/duncanjbrown-plain-route)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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