PHP code example of kel / hooks

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

    

kel / hooks example snippets


use Kel\Load;
use Kel\Hooks;

//create a new Hooks instance 
//passing an array of config options is optional
//__NB: Multiple hooks can be added to the same hook point__
$hook = new  Hooks(Load::config(__DIR__.'/config.php'));

//add a hook init.php to the hook point init
//the hook point is created if it does not exist 
$hook->add_hook('init', "init.php"); 

//add a hook init.php to the hook point final
$hook->add_hook('final', "init.php");

//run the hook init
$hook->run_hook('init');

//run the hook final
$hook->run_hook('final');