konekt/xtend

Library to support creating extendable, plugin-aware applications

Maintainers

👁 konekt

Package info

github.com/artkonekt/xtend

pkg:composer/konekt/xtend

Statistics

Installs: 106 371

Dependents: 7

Suggesters: 0

Stars: 1

Open Issues: 0

2.0.0 2025-03-18 12:53 UTC

Requires

  • php: ^8.2

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 548c0caaee3b0d5b801e7f18af7686a9a7d0c1f1

  • Attila Fulop

pluginsextensionshookskonekt

This package is auto-updated.

Last update: 2026-06-17 15:13:06 UTC


README

👁 Tests
👁 Packagist version
👁 Packagist downloads
👁 StyleCI
👁 MIT Software License

Requirements

  • PHP 8.2+

Features

  • Registries
  • Hooks

Installation

You can install the package via composer:

composer require konekt/xtend

Usage

Registries

The following example shows a sample registry that holds reference to various PaymentGateway implementations.

Steps:

  1. Create a class
  2. Add the Registry interface
  3. Use the HasRegistry and RequiresClassOrInterface traits
  4. Add the $requiredInterface static property, and set the interface
final class PaymentGateways implements Registry
{
 use HasRegistry;
 use RequiresClassOrInterface;
 
 private static string $requiredInterface = PaymentGateway::class;
}

Having that, other developers can add new payment gateways:

PaymentGateways::add('braintree', BrainTreePaymentGateway::class);