PHP code example of getpop / hooks

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

    

getpop / hooks example snippets


use PoP\Hooks\Facades\HooksAPIFacade;

// Get an instance of the service
$hooksapi = HooksAPI::getInstance();

// Add a hook for an Action
$hooksapi->addAction($actionName, $functionName, $priority, $argNum);

// Add a hook for a Filter
$hooksapi->addFilter($filterName, $functionName, $priority, $argNum);

// Execute an Action
$hooksapi->doAction($actionName, $param1, $param2, ...);

// Execute a Filter
$filterValue = $hooksapi->applyFilters($filterName, $filterValue, $param1, $param2, ...);

// Remove an Action
$hooksapi->removeAction($actionName, $functionName, $priority, $argNum);

// Remove a Filter
$hooksapi->removeFilter($filterName, $functionName, $priority, $argNum);
 php
\PoP\Root\App::stockAndInitializeComponentClasses([([
    \PoP\Hooks\Component::class,
]);
 bash
composer analyse