Skip to content
bleedingdeaconsPublic

About

A abstract call management system, providing supporting classes for specific drivers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Beacon — Call-Forwarding Contracts

CI Semgrep Coverage Status PHPStan PHPCS Version PHP Licence

Call-forwarding contracts for the Bleeding Deacons suite. A Composer library, not a WordPress plugin — it is never activated. Tamar (the driver for Tamar Telecommunications' panel) and Trusted (the rota) each require it, and it is loaded by their own Composer autoloaders.

Until 2026-09-22 Beacon was a plugin of its own that owned a PSR-11 container and fired beacon/loaded. It became a library so call forwarding stops needing a separate plugin to be installed and activated alongside the one that actually does the work.

Versions restart at v1.0.1 (2026-10-09). As a library Beacon reached v3.0.1, a number carried over from its plugin years; it was renumbered to v1, keeping the minor and patch, as Tamar and Trusted were. Every earlier tag and GitHub Release was deleted — the plugin-era v1.4.x tags would otherwise have satisfied ^1.0 — so ^1.0 means the library and nothing older.

How a driver reaches a consumer

Tamar (plugins_loaded)  ──bind──▶  ForwardingRegistry  ◀──get──  Trusted (when it needs a driver)
  • Tamar builds its driver behind a resolver and calls ForwardingRegistry::bind().
  • Trusted calls ForwardingRegistry::get() at the moment it needs to forward, and gets null when no driver is bound.

Both plugins vendor their own copy of this package, but a PHP class loads once per request, so whichever autoloader supplies ForwardingRegistry both plugins share its state. Nothing depends on which plugin WordPress includes first.

Keep the two copies compatible. Whichever plugin's autoloader loads a class first supplies it to both, so Tamar and Trusted should require the same major version. A breaking change here is a new major, and both consumers move to it together.

What it ships

Beacon\Forwarding\Interfaces\CallForwardingService The driver contract — list/save/delete rules, list targets, commit, test.
Beacon\Forwarding\ForwardingRegistry Where a driver is published and a consumer finds it.
Beacon\Forwarding\Interfaces\ForwardingException Common throwable for driver failures.
Beacon\Forwarding\Models\ForwardingRule Immutable value object: match condition + target.
Beacon\Targets\Models\ForwardingTarget Immutable value object: destination (number/extension/voicemail).
Beacon\Forwarding\AbstractCallForwardingService Shared validation + hydration drivers can extend.
Beacon\Transport\… HttpTransport contract and the WordPress HTTP API implementation.
Beacon\Core\BeaconContainer Minimal PSR-11 container a driver can wire itself with.
Beacon\Capabilities\CapabilityBootstrap The forwarding roles and capabilities below.
Beacon\Rest\ForwardingRestController Optional beacon/v1 REST API over the bound driver.

The capabilities and the REST controller are classes only. The driver plugin wires them: Tamar registers the roles on activation, removes them on deactivation and uninstall, and registers the REST routes when BEACON_ENABLE_REST is defined in wp-config.php.

Installation

In the consuming plugin's composer.json:

"repositories": [
    { "type": "vcs", "url": "https://github.com/bleedingdeacons/beacon" }
],
"require": {
    "bleedingdeacons/beacon": "^1.0"
}

Releases are vX.Y.Z tags cut by hand on main. There is no zip and no GitHub Release asset.

Capabilities

Capability Granted to
beacon_manage_forwarding Operator only — create / delete rules, change connection settings.
beacon_route_forwarding Operator + Dispatcher — switch existing rules between targets.
beacon_push_config Operator + Dispatcher — commit pending changes upstream.
beacon_view_forwarding Operator + Dispatcher + Viewer — read-only audit.

Requirements

  • WordPress 6.1+
  • PHP 8.6+

Testing

Install the dev dependencies and run the suite from the repository root:

composer install
Command Description
composer test Run the full Pest test suite
composer test:unit Run unit tests only
composer test:integration Run integration tests only
composer test:coverage Generate an HTML coverage report
composer phpstan Run PHPStan static analysis
composer cs Check coding standards
composer cs:fix Auto-fix coding standard violations
composer check Run CS + PHPStan + tests in sequence

Line coverage is reported to Coveralls on every CI run — see the coverage badge at the top of this file.


License

GPL-2.0+

About

A abstract call management system, providing supporting classes for specific drivers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages