Download the PHP package minfrastructure/chains without Composer

On this page you can find all versions of the php package minfrastructure/chains. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package chains

Chains

A PHP library for building event-driven execution chains with hooks, callbacks, policies, and a rich result system. Zero dependencies.

Chains lets you wrap any operation in a structured pipeline of phases and hooks, so that internal and external code can intercept, validate, transform, or react to every step — without tight coupling.

Current library focuses on reusability. You can implement once and customize the class behavior on according to the business needs.

Requirements

Installation

Quick Start

You can run the latest example here

How It Works

Every call to EventExecutor::run() executes a fixed sequence of phases:

Key Concepts

Result

The value object that flows through the chain. Carries state flags and a data payload.

Callback Return Contract

Every hook/callback receives ($data, $phase, $executor, $result) and returns:

Return value Effect
null or true Continue with the current result unchanged
BasicResultInterface Replace the current result

CommonEvents Helpers

Ready-made [Meta, callable] pairs for property operations on objects — including protected/private properties. Use the spread operator to pass them to EventExecutor::run():

CallbackInterface

Objects that implement CallbackInterface (via CallbackTrait) can register their own callbacks. The executor picks them up automatically:

Execution Policy

DefaultEventExecutorPolicy controls chain behavior:

Source Interfaces

An instance can implement these optional interfaces so the executor automatically queries it for configuration — no extra arguments needed:

Interface Method Purpose
EventSourceDataInterface getEventData($name, $data) Provide custom event data
EventSourceHooksInterface getEventHooks($name, $hooks) Inject hooks automatically
EventSourcePolicyInterface getEventExecutorPolicy($name) Provide per-event policy

Retry Mechanism

A callback can request a retry by calling setAgain() on the result. The executor triggers ON_AGAIN, then re-runs the callback up to againLimit times:

Examples

The examples/ directory contains runnable scripts covering every feature:

File Topic
01_minimal.php Simplest possible usage
02_hooks_and_phases.php Full phase lifecycle, terminal hooks
03_results.php Result creation, states, from()
04_common_events.php getter/setter/adding/removing/cleanup, safe reflection
05_callbacks.php CallbackInterface, PRE/POST stages, priority
06_policy.php All policy options demonstrated
07_retry.php again mechanism, limits, abort
08_source_interfaces.php EventSourceData/Hooks/Policy interfaces
09_model_lifecycle.php Full domain model with event-driven getters/setters

Tutorial

See TUTORIAL.md for a step-by-step walkthrough from basic usage to building a full domain model with event-driven property access.


All versions of chains with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package minfrastructure/chains contains the following files

Loading the files please wait ...