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.1k—0%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 1mo 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

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

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

3763d 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

[stripe/stripe-php

Stripe PHP Library

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

A PHP wrapper for Twilio's API

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

GitHub API v3 client

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

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[microsoft/microsoft-graph

The Microsoft Graph SDK for PHP

65723.5M95](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

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