Download the PHP package eoneopay/webhooks without Composer
On this page you can find all versions of the php package eoneopay/webhooks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package webhooks
EoneoPay Activity/Webhook Library
This library adds support for creating Activities which are then fired as webhooks to subscribers of those activities.
Installation
Use Composer to install the package in your project:
Usage
Inject the \EoneoPay\Webhooks\Activities\Interface\ActivityFactoryInterface service
into your application where an activity needs to be created. The send method on this
interface accepts an ActivityDataInterface implementation that represents a specific
activity to be created.
For each of the different activities you will fire inside your application you will need
to create a class that implements ActivityDataInterface.
Theory of Operation
ActivityFactoryInterfacereceives an instance ofActivityDataInterface- The factory will then call the
PayloadManagerto build the payload for theActivityDataInterface - The factory will take the payload and the
ActivityDataInterfaceand save it as a newActivityInterfaceentity. - Finally, the factory will dispatch an ActivityCreatedEvent
- The factory will then call the
- The listeners will receive the event inside an asynchronous queue worker and call
WebhookManager#processActivity- The WebhookManager will resolve any subscriptions for the activity
- Then it will create a new WebhookRequest for each subscription
- And dispatch a new WebhookRequestCreatedEvent.
- Another listener will accept this event and call
RequestProcessor#process- Which builds a PSR7 Request
- Sends the request
- Records the result as a WebhookResponse
Integration
Laravel
To integrate the package into your Laravel or Lumen you need to register the following service providers:
Any implementation of this library will need to:
- Implement and bind a service for the interface
EoneoPay\Webhooks\Subscription\Interfaces\SubscriptionResolverInterface -
Implement a service for the interface
EoneoPay\Webhooks\Payload\Interfaces\PayloadBuilderInterface-
example
- bind and tag the service for the interface
YourNamespace\WebHookPayloadBuilderInterface
-
- Add
EoneoPay\Externals\Bridge\Laravel\ORM\ResolveTargetEntityExtensiontoconfig/doctrine.phpunder theextensionskey - Modify
config/doctrine.phpto add the following changes to the configuration:
All versions of webhooks with dependencies
doctrine/orm Version ^2.6.3
eoneopay/externals Version ^1.0
eoneopay/utils Version ^0.2
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^6.0.0