PHP code example of mediawiki / parser-hooks

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

    

mediawiki / parser-hooks example snippets


$awesomeHookDefinition = new HookDefinition( 'awesome', [ /* ... */ ] );
$anotherHookDefinition = new HookDefinition( 'another', [ /* ... */ ] );

$awesomeHookHandler = new AwesomeHookHandler( /* ... */ );
$anotherHookHandler = new AnotherHookHandler( /* ... */ );

$hookRegistrant = new HookRegistrant( $mediaWikiParser );

$hookRegistrant->registerFunctionHandler( $awesomeHookDefinition, $awesomeHookHandler );
$hookRegistrant->registerFunctionHandler( $anotherHookDefinition, $anotherHookHandler );

$hookRegistrant->registerFunctionHandler( $extraAwesomeHookDefinition, $awesomeHookHandler );

$hookRegistrant->registerFunctionHandler( $awesomeHookDefinition, $awesomeHookHandler );

$hookRegistrant->registerHookHandler( $awesomeHookDefinition, $awesomeHookHandler );