PHPackages                             and/whmcs-module-framework - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. and/whmcs-module-framework

ActiveLibrary

and/whmcs-module-framework
==========================

WHMCS mini framework for module/plugin (+ some utilites bunch)

v0.7.x-dev(5y ago)62.7k7[1 PRs](https://github.com/logical-and/whmcs-module-framework/pulls)PHP

Since Dec 4Pushed 5y ago4 watchersCompare

[ Source](https://github.com/logical-and/whmcs-module-framework)[ Packagist](https://packagist.org/packages/and/whmcs-module-framework)[ RSS](/packages/and-whmcs-module-framework/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

WHMCS Module Framework
======================

[](#whmcs-module-framework)

How to use:
-----------

[](#how-to-use)

`1.` Create addon/plugin inside WHMCS modules directory, for example "plugin-name"

`2.` Create file "plugin-name.php" inside "plugin-name" directory

```
$bootstrap = require_once __DIR__ . '/vendor/and/whmcs-module-framework/bootstrapper.php';
$bootstrap();

return Addon::registerModuleByFile(__FILE__,
   Addon::configBuilder()
   ->setName('My Plugin Friendly Name')
   ->setDescription('description')
   ->setAuthor('And')
   ->addField(FieldConfigBuilder::dropdown('choice', 'Type')->addOption('One and only option', 'option1'))
   ->build());
```

`3.` Create "hooks.php" inside "plugin-name" directory

```
ModuleHooks::registerHooks([
    YourHookClass::class,
    CallbackHook::createCallback('eventName', 0, function() {})
]);
```

or

```
CallbackHook::attachCallback('InvoiceCreation', 0, function() {
    echo $this->getModule()->getId();
    echo $this->view('smarty.tpl', ['var' => 'value']);
});
CallbackHook::attachCallback(Invoice\InvoiceCreated::KEY, 0, function() {
    // Do your things here
});
```

Api requestor:
--------------

[](#api-requestor)

```
$orders = APIFactory::orders()->getOrders($userId, 'Pending');
// No result, most cases is error
if (!$orders->isLoaded()) {
    return;
}
```

```
APIFactory::billing()
->addCredit($userId, $invoice['credit'],
    sprintf('Refund of customers credit for "%s" because of order "%s" cancellation (Blazing Dashboard Proxy)',
        $invoice['credit'], $order['id']))
->validate('result=success')
```

### Methods in response to use:

[](#methods-in-response-to-use)

- **\#isLoaded**() - false if error, or wrong response; each response validates by data path defined in request methods, for example for getInvoices it is **invoices.invoice**
- **\#validate**(key, messageForException, exceptionClass = ResponseException) - key can be path.with.dots
- **\#getApiMethod**()
- **\#getApiArgs**()
- **\#\_\_toString**() - json encoded data

Response is valid array, except you can use to get values path.with.dots (nested array path). Even more convenience - path is case-insensitive One thing - you can change (set/unset) values in array.

Response by default relative by data container (for getInvoices it is **invoices.invoice**), but if you want to get data from root you should use path *data.rootResponseValue*

Page Hooks
----------

[](#page-hooks)

Methods to inject custom content to any page. Usage:

```
AnyPageHook::buildInstance()->setPosition(AnyPageHook::POSITION_HEAD_BOTTOM)->setCodeCallback(function($vars) {
    $page = $vars['templatefile'];

    return "";
})->apply()
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~567 days

Total

3

Last Release

1949d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0499fdd6338e1520be3ab6776948652c429291c08b79504a2eec2315d73787ab?d=identicon)[And](/maintainers/And)

---

Top Contributors

[![logical-and](https://avatars.githubusercontent.com/u/1403109?v=4)](https://github.com/logical-and "logical-and (90 commits)")[![xilnick](https://avatars.githubusercontent.com/u/13090152?v=4)](https://github.com/xilnick "xilnick (7 commits)")[![slonv23](https://avatars.githubusercontent.com/u/2405657?v=4)](https://github.com/slonv23 "slonv23 (2 commits)")

### Embed Badge

![Health badge](/badges/and-whmcs-module-framework/health.svg)

```
[![Health](https://phpackages.com/badges/and-whmcs-module-framework/health.svg)](https://phpackages.com/packages/and-whmcs-module-framework)
```

###  Alternatives

[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k172.9M1.8k](/packages/symfony-security-bundle)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[laravel/reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.

1.5k9.4M48](/packages/laravel-reverb)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[api-platform/http-cache

API Platform HttpCache component

223.2M7](/packages/api-platform-http-cache)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
