flycartinc / hook
Do action and filters with Herbert
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
pkg:composer/flycartinc/hook
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-10-30 02:31:54 UTC
README
Add the bellow piece of code in plugin.php to set $app in Facade
if ( is_plugin_active(plugin_basename( __FILE__ )) ) {
   $plugin = new \Herbert\Framework\Base\Plugin(plugin_dir_path( __FILE__ ));
   $herbert->registerPlugin($plugin);
   $app = $plugin->getContainer();
   FlycartHook\Facades\Facade::setFacadeApplication($app);
}
Add the bellow piece of code in herbert.config.php to load FlycartHook service provider
'providers' => array(
       FlycartHook\HookServiceProvider::class
       )
Flycart Hook Example
\FlycartHook\Facades\Action::add('init', 'ClassName@functionName');
\FlycartHook\Facades\Action::run('eventname', $args);
\FlycartHook\Facades\Filter::add('eventname', 'ClassName@functionName');
\FlycartHook\Facades\Filter::run('eventname', $args);