PHPackages                             jascha030/wp-subscriptions - 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. jascha030/wp-subscriptions

AbandonedArchivedLibrary

jascha030/wp-subscriptions
==========================

OOP Interface for using the WP Plugin API (Hooks)

2.0.1(5y ago)1444MITPHP

Since Apr 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jascha030/wp-subscriptions)[ Packagist](https://packagist.org/packages/jascha030/wp-subscriptions)[ RSS](/packages/jascha030-wp-subscriptions/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (1)Versions (5)Used By (4)

WP Subscriptions
================

[](#wp-subscriptions)

Backbone for interfacing with the Wordpress Plugin Common API (Hooks). Keeping track of actions and filters and making it easy to hook or unhook class methods.

Geting started
--------------

[](#geting-started)

#### Requirements

[](#requirements)

- `composer`
- `php >= 7.1`

> This package does not keep in mind, the *Wordpress Coding Standards* and therefore is not compatible with `php 5.3` or any other versions before `php 7.1`

#### Installation

[](#installation)

```
composer require jascha030/wp-subscriptions
```

Usage
-----

[](#usage)

#### Providers

[](#providers)

The two basic types of providers are the `ActionProvider` and the `FilterProvider` interfaces. These interfaces are derivatives of the `SubscriptionProvider` interface.

These interfaces don't require any methods to be implemented and are used by the `WordpressSubscriptionContainer` and other core logic to identify a class within a Wordpress plugin.

These Providers use a static property that tells the Subscription manager to hook specific methods to WP plugin hooks.

Actions:

```
public static $actions = []; // ActionProvider interface
```

Filters:

```
public static $filters = []; // FilterProvider interface
```

Provider example:

```
class ExampleProvider implements ActionProvider
{
    public static $actions = [
        'plugins_loaded' => 'load', // Hook => method
        'pre_get_posts' => ['doQueryStuff', 10, 1], // Example with priority and number of arguments
        'wp_loaded' => [
            ['loaded'],
            ['moreLoaded']
        ], // Example of multiple methods hooked to one action hook
    ];

    public function load() // Method to be hooked to the plugins_loaded hook
    {
        echo "This is a method that loads stuff...";
    }

    public function doQueryStuff()
    {
        // hmmm, doing lots of querylicious stuff
    }

    public function loaded()
    {
        // Much load, such wow, very plugadocious
    }

    public function moreLoaded()
    {
        // Will it ever stop??
    }
}
```

This example shows a basic ActionProvider a class can also implement ActionProvider and FilterProvider at the same time.

#### Registering a provider

[](#registering-a-provider)

```
$subscriptionContainer = WordpressSubscriptionContainer::getInstance(); // Get container instance

$subscriptionContainer->register(ExampleProvider::class); // Register provider

$subscriptionContainer->run(); // Hook all providers and their methods to hooks
```

Info and inspiration
--------------------

[](#info-and-inspiration)

The subscription idea provides flexibility, so you don't have to overuse the singleton pattern in OOP wordpress plugins. Now you are not restricted to extending classes for every other instance you need (for example: when you build a post type class you can create a config with post types you can loop trough instead of having to make separate classes for each post type).

Based on idea from [this article](https://carlalexander.ca/polymorphism-wordpress-interfaces/) by Carl Alexander.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

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

Total

3

Last Release

2163d ago

Major Versions

1.0.3 → 2.0.12020-06-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/6109ecdd6607e0eec043d8adf1951cf700c0b030ab2fe3fff4525d961b6a50b7?d=identicon)[Jascha030](/maintainers/Jascha030)

---

Top Contributors

[![jascha030](https://avatars.githubusercontent.com/u/25476438?v=4)](https://github.com/jascha030 "jascha030 (179 commits)")

---

Tags

composer-packagehookswordpresswordpress-developmentwordpress-plugin

### Embed Badge

![Health badge](/badges/jascha030-wp-subscriptions/health.svg)

```
[![Health](https://phpackages.com/badges/jascha030-wp-subscriptions/health.svg)](https://phpackages.com/packages/jascha030-wp-subscriptions)
```

###  Alternatives

[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[api-platform/state

API Platform state interfaces

223.4M57](/packages/api-platform-state)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)[symfony/json-streamer

Provides powerful methods to read/write data structures from/into JSON streams.

14440.0k8](/packages/symfony-json-streamer)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

632.3k](/packages/rubix-server)

PHPackages © 2026

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