Skip to content

v2.0.0-beta.1

Pre-release
Pre-release

Choose a tag to compare

@magdicom magdicom released this 07 Sep 10:31

magdicom/hooks v2.0.0-beta.1 is the first prerelease of the version 2 line.

Version 2 is intentionally breaking. It removes the version-1 legacy dispatch APIs, global parameter state, shared output state, and output helpers. The replacement API separates hook behavior explicitly:

  • actions for side effects
  • filters for sequential transformations
  • collectors for obtaining callback results

Install the beta with:

composer require magdicom/hooks:"^2.0@beta"

Requirements:

  • PHP 8.2 or newer

Highlights:

  • explicit actions, filters, and collectors
  • deterministic priorities and listener snapshots during dispatch
  • instance-owned registration handles
  • variadic invocation arguments
  • framework-neutral resolver support for non-static class callbacks and class-name processors/renderers
  • collector processors and renderers
  • built-in concatenate, first, first-non-null, last, flatten, merge, boolean-AND, and boolean-OR processing
  • removal of version-1 legacy APIs and global output state

Upgrade notes:

  • Read the migration guide before upgrading: https://github.com/magdicom/hooks/blob/2.0/UPGRADE.md
  • collect() executes all collector callbacks and returns raw one-entry-per-callback results.
  • process() and render() use configured collector processors/renderers after raw collection.

The Laravel wrapper has not yet been migrated or integration-tested against this beta.

Please report beta issues through GitHub Issues: https://github.com/magdicom/hooks/issues