Pentagonal Addons is the advanced level for WHMCS. It can make additional level of whmcs rule
- Autoload the hooks on active templates
- Autoload the service on active templates
templates/
└── template-name/
├── schema/
│ └── theme.json (the theme schema)
├── hooks/
│ └── hooks.php (the hooks file)
└── services/
└── services.php (the services file)Autoload the hooks and services on active templates should be placed on the hooks and services directory and should declare on schema/theme.json with
hooks: true and services: true
See options+themes.json for the schema structure
Hooks
hooks.php - see the https://developers.whmcs.com/hooks/hook-index/
For list of available hooks
<?php
declare(strict_types=1);
namespace Pentagonal\Neon\WHMCS\Theme;
use Pentagonal\Neon\WHMCS\Addon\Hooks;
if (!isset($hooks) || !$hooks instanceof Hooks) {
return;
}
if (!defined('WHMCS')) {
header('Location: ../../', true, 301);
exit();
}
$dynamicHooks = $hooks->createDynamicHook(
'ClientAreaPage',
function ($vars) {
// do in vars
return $vars;
},
10,
'ClientAreaPage'
);
// queue the hooks
$hooks->queue($dynamicHooks);Services
services.php - the service file, load before hooks.php loaded
<?php
declare(strict_types=1);
namespace Pentagonal\Neon\WHMCS\Theme;
use Pentagonal\Neon\WHMCS\Addon\Abstracts\AbstractService;use Pentagonal\Neon\WHMCS\Addon\Interfaces\RunnableServiceInterface;use Pentagonal\Neon\WHMCS\Addon\Services;
if (!isset($services) || !$services instanceof Services) {
return;
}
if (!defined('WHMCS')) {
header('Location: ../../', true, 301);
exit();
}
class ExampleService extends AbstractService implements RunnableServiceInterface
{
/**
* @inheritDoc
*/
protected function dispatch(...$args)
{
// @todo do the service dispatch
}
}
$services->add(ExampleService::class);To generate WHMCS stubs, you can use the following command:
php bin/gen_stub.php --whmcs-dir /path/to/whmcsAccepted Arguments
--whmcs-dir=[whmcs-path]- whmcs installation directory-qor--quietto quiet (without value)-for--forceto continue without interactive (without value)-vor-vvor-vvvthe verbose level (without value)
Please make sure the WHMCS already installed and properly configured.
And the php-cli for execution already configure with ioncube loader installed.