PHP code example of ssitu / hekate

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

    

ssitu / hekate example snippets


use \SSITU\Hekate\Hekate;

 default: false
$Hekate = new Hekate();
// or
$Hekate = new Hekate($throwException);
// and also
$Hekate->setThrowException($throwException);

$priority = 1; #default: 2

# Functions:
$Hekate->register('funcName', ['funcArgm1', 'funcArgm2'], $priority);

# Methods:
$Hekate->register(['className', 'publicStaticMethodName'], ['someMethodArgm'], $priority);
// or use helper:
$Hekate->registerMethod('className', 'publicStaticMethodName', ['someMethodArgm'], $priority);

// Class passed as string can only register static method.
// Otherwise, pass object:
$Hekate->registerMethod(new SomeClass(), 'publicMethodName',  ['someMethodArgm'], $priority);

# Deregister:
$registrationId = $Hekate->register('callable');
$Hekate->deregister($registrationId);

// when exception throwing is turned off: register method will return FALSE in case of invalid callback
$registrationId = $Hekate->register('badCallable');
if($registrationId === false){
    // handle it the way you prefer
}