PHP code example of voku / php-hooks

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

    

voku / php-hooks example snippets




$hooks = Hooks::getInstance();

$hooks->add_action('header_action','echo_this_in_header');

function echo_this_in_header(){
   echo 'this came from a hooked function';
}



$hooks = Hooks::getInstance();

echo '<div id="extra_header">';
$hooks->do_action('header_action');
echo '</div>';
shell
composer