PHP code example of snicco / better-wp-hooks-bundle

1. Go to this page and download the library: Download snicco/better-wp-hooks-bundle 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/ */

    

snicco / better-wp-hooks-bundle example snippets



// /path/to/configuration/bundles.php

use Snicco\Bundle\BetterWPHooks\BetterWPHooksBundle;
use Snicco\Component\Kernel\ValueObject\Environment;

return [
    
    'bundles' => [
        Environment::ALL => [
            BetterWPHooksBundle::class
        ]   
    ]   
];


use Psr\EventDispatcher\EventDispatcherInterface;
use Snicco\Component\BetterWPHooks\EventMapping\EventMapper;
use Snicco\Component\EventDispatcher\EventDispatcher;


/**
* @var Kernel $kernel
*/
$kernel->boot();

$event_dispatcher = $kernel->container()->make(EventDispatcher::class);

$psr_event_dispatcher = $kernel->container()->make(EventDispatcherInterface::class);

var_dump($event_dispatcher === $psr_event_dispatcher); // true

$event_mapper = $kernel->container()->make(EventMapper::class);