PHP code example of eonx-com / webhooks

1. Go to this page and download the library: Download eonx-com/webhooks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eonx-com / webhooks example snippets



declare(strict_types=1);

use EoneoPay\Externals\Bridge\LaravelDoctrine\Extensions\ResolveTargetEntityExtension;
use EoneoPay\Webhooks\Models\ActivityInterface;
use EoneoPay\Webhooks\Models\WebhookRequestInterface;
use EoneoPay\Webhooks\Models\WebhookResponseInterface;
use EoneoPay\Webhooks\Bridge\Doctrine\Entities\Activity;
use EoneoPay\Webhooks\Bridge\Doctrine\Entities\Lifecycle\Request;
use EoneoPay\Webhooks\Bridge\Doctrine\Entities\Lifecycle\Response;

return [
    'managers' => [
        'default' => [
            // ...
            'namespaces' => [
                // ...
                // Add the Webhooks Entities to the namespace mappings
                'Eoneopay\\Webhooks\\Bridge\\Doctrine\\Entities'
            ],
            'paths' => [
                // ...
                // Add the Webhooks filepath to the Entity Manager
                \base_path('vendor/eoneopay/webhooks/src/Bridge/Doctrine/Entities')
            ]
            // ...
        ]
    ],
    
    // ...
    
    'extensions' => [
        // ...
        // Add the ResolveTargetEntityExtension to Doctrine
        ResolveTargetEntityExtension::class
    ],
    
    // ...
    
    'replacements' => [
        // Add replacements so Doctrine can look up entities by interface
        ActivityInterface::class => Activity::class,
        WebhookRequestInterface::class => Request::class,
        WebhookResponseInterface::class => Response::class
    ]
];

    $this->app->bind(WebHookPayloadBuilderInterface::class, PayloadBuilder::class);
    $this->app->tag([WebHookPayloadBuilderInterface::class], ['webhooks_payload_builders']);