cline/cascade

Multi-source resolution with fallback chains for PHP

Maintainers

👁 faustbrian

Package info

github.com/faustbrian/cascade

pkg:composer/cline/cascade

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.2 2026-03-18 16:45 UTC

Requires

Requires (Dev)

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT 9f1524f722953b582d0c8348c22b180c642820f7

  • Brian Faust <brian.woop@cline.sh>

phpconfigurationresolvermulti-tenantcredentialscascadefallback

This package is auto-updated.

Last update: 2026-06-18 17:26:27 UTC


README

👁 GitHub Workflow Status
👁 Latest Version on Packagist
👁 Software License
👁 Total Downloads

Cascade is a framework-agnostic resolver that fetches values from multiple sources in priority order, returning the first match. Perfect for implementing customer-specific → tenant-specific → platform-default fallback chains.

Think: "Get the FedEx credentials for this customer, falling back to platform defaults if they don't have their own."

Requirements

Requires PHP 8.4+

Installation

composer require cline/cascade

Documentation

Full documentation is available at docs.cline.sh/cascade

Quick Example

use Cline\Cascade\Cascade;
use Cline\Cascade\Source\CallbackSource;

// Build a resolution chain
$cascade = new Cascade();

$cascade->from(new CallbackSource(
 name: 'customer',
 resolver: fn($key, $ctx) => $customerDb->find($ctx['customer_id'], $key),
))
 ->fallbackTo(new CallbackSource(
 name: 'platform',
 resolver: fn($key) => $platformDb->find($key),
 ))
 ->as('credentials');

// Resolve with context
$apiKey = $cascade->using('credentials')
 ->for(['customer_id' => 'cust-123'])
 ->get('fedex-api-key');
// Tries customer source first, falls back to platform if not found

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please use the GitHub security reporting form rather than the issue queue.

Credits

License

The MIT License. Please see License File for more information.