Skip to content

phpnomad/event

Repository files navigation

PHPNomad Repository

This is a new repository for PHPNomad. I'm sure it'll be really cool, but I don't have much else to say about it yet. Hang tight, I'm sure this will change :)

Example of Binding For an Integration

class OrderReceived implements Event
{
    public function __construct(int $orderId)
    {
        $this->orderId = $orderId;
    }
    public static function getId(): string
    {
        return 'orderReceived';
    }
}

final class WooCommerceIntegration implements Loadable
{
    use HasSettableContainer;

    public function load(): void
    {
        $bindingInstance = $this->container->get(ActionBindingStrategy::class);

        $bindingInstance->bindAction(
            OrderReceived::class,
            'woocommerce_order_status_completed',
            fn(int $orderId) => new OrderReceived($orderId)
        );
    }
}

About

Abstractions for Event-based architecture

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages