PHPackages                             asamserver/wam - 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. [Framework](/categories/framework)
4. /
5. asamserver/wam

ActiveProject[Framework](/categories/framework)

asamserver/wam
==============

Framework for creating WHMCS addon modules.

v1.1.0(1y ago)1108MITPHPPHP &gt;=8.0

Since Nov 24Pushed 1y agoCompare

[ Source](https://github.com/asamserver/wam)[ Packagist](https://packagist.org/packages/asamserver/wam)[ RSS](/packages/asamserver-wam/feed)WikiDiscussions main Synced 1mo ago

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

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

[](#whmcs-addon-module-framework)

A Laravel-inspired framework for building WHMCS addon modules with modern PHP practices and a familiar structure. This framework provides a robust foundation for developing WHMCS addons with features like routing, MVC architecture, database migrations, and hooks management.

Features
--------

[](#features)

- MVC Architecture
- Route Management
- Database Migrations
- Model Generation
- Controller Generation
- Hook System
- CLI Commands
- Admin &amp; Client Area Support
- Helper Functions
- Resource Management (CSS, JS, Views)

Installation
------------

[](#installation)

1. Create a new directory for your addon in the WHMCS modules/addons directory:

```
cd modules/addons
mkdir your_addon_name
cd your_addon_name
```

2. Clone this repository:

```
git clone https://github.com/yourusername/wam.git .
```

3. Install dependencies:

```
composer install
```

4. Set up your environment:

```
cp .env.example .env
```

5. Configure your .env file with appropriate database settings:

```
DB_PREFIX=mod_youraddonname
APPENV=local

```

### Quick Installation

[](#quick-installation)

1. Navigate to your WHMCS modules/addons directory:

```
cd modules/addons
```

2. Create a new addon using Composer:

```
composer create-project asamserver/wam your_addon_name dev-main
```

Command Line Interface
----------------------

[](#command-line-interface)

The framework provides a CLI tool named `asam` for generating various components. Here are the available commands:

### Basic Commands

[](#basic-commands)

```
# Create a new addon
php asam make:addon YourAddonName

# Generate a controller
php asam make:controller Admin/DashboardController

# Create a model
php asam make:model User

# Generate a migration
php asam make:migration users

# Run migrations
php asam migrate

# Create a hook
php asam make:hook ClientLogin

# Generate web routes
php asam make:web
```

Directory Structure
-------------------

[](#directory-structure)

```
your_addon_name/
├── app/
│   ├── Controllers/
│   ├── Models/
│   ├── Hooks/
│   ├── Dispatcher/
│   ├── Helper/
│   └── Application.php
├── database/
├── resource/
│   ├── css/
│   ├── js/
│   └── views/
├── routes/
│   └── web.php
├── storage/
│   └── logs/
└── vendor/

```

Creating Controllers
--------------------

[](#creating-controllers)

Controllers handle the business logic of your addon. To create a new controller:

```
php asam make:controller Admin/DashboardController
```

Example controller structure:

```
namespace WHMCS\Module\Addon\YourAddon\app\Controllers;

class DashboardController extends BaseController
{
    public function index(array $vars)
    {
        return $this->renderView('admin.dashboard', [
            'title' => 'Dashboard'
        ]);
    }
}
```

Defining Routes
---------------

[](#defining-routes)

Routes are defined in the `routes/web.php` file:

```
use WHMCS\Module\Addon\YourAddon\app\Controllers\Admin\DashboardController;

$this->get('/admin/dashboard', DashboardController::class, 'index');
$this->get('/client/dashboard', ClientDashboardController::class, 'index');
```

Working with Models
-------------------

[](#working-with-models)

Create models to interact with your database:

```
php asam make:model User
```

Example model usage:

```
namespace WHMCS\Module\Addon\YourAddon\app\Models;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $fillable = ['name', 'email'];
}
```

Database Migrations
-------------------

[](#database-migrations)

Create and run database migrations:

```
# Create a migration
php asam make:migration create_users_table

# Run migrations
php asam migrate
```

Example migration:

```
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email');
            $table->timestamps();
        });
    }
}
```

Working with Hooks
------------------

[](#working-with-hooks)

Create and manage WHMCS hooks:

```
php asam make:hook ClientLogin
```

Example hook:

```
namespace WHMCS\Module\Addon\YourAddon\app\Hooks;

class ClientLoginHook
{
    public function handle(array $params)
    {
        // Hook logic here
    }
}
```

Views and Templates
-------------------

[](#views-and-templates)

Views are stored in the `resource/views` directory. Render views from your controllers:

```
public function index(array $vars)
{
    return $this->renderView('admin.dashboard', [
        'title' => 'Dashboard',
        'data' => $someData
    ]);
}
```

Helper Functions
----------------

[](#helper-functions)

The framework provides various helper functions in `app/Helper/Helper.php`:

```
// Get current client ID
$clientId = YourAddon_getClientId();

// Generate random number
$random = YourAddon_generateRandomNumber();
```

Best Practices
--------------

[](#best-practices)

1. Always use namespaces as defined in the framework
2. Follow the MVC pattern
3. Use migrations for database changes
4. Keep controllers thin and move business logic to services
5. Use dependency injection where possible
6. Log important events using the built-in logging system

Error Handling
--------------

[](#error-handling)

The framework includes built-in error handling:

```
try {
    // Your code here
} catch (\Exception $e) {
    $this->hooksManager->log("Error: " . $e->getMessage(), 'ERROR');
}
```

Contributing
------------

[](#contributing)

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License
-------

[](#license)

This project is licensed under the MIT License - see the LICENSE.md file for details

Support
-------

[](#support)

For support, please open an issue in the GitHub repository or contact the maintainers.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98% 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 ~1 days

Total

2

Last Release

540d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79af00f03b890d2d1904a4f16361b6123d1942ced682fbc96ff9fab881b1bad9?d=identicon)[miladyousefi](/maintainers/miladyousefi)

![](https://www.gravatar.com/avatar/1a9de9450f462afb8b03d7fa2113a23d659cce8e604678f459df15e32993781c?d=identicon)[devgitasamserver](/maintainers/devgitasamserver)

---

Top Contributors

[![miladyousefi](https://avatars.githubusercontent.com/u/58238218?v=4)](https://github.com/miladyousefi "miladyousefi (146 commits)")[![amir377](https://avatars.githubusercontent.com/u/46271195?v=4)](https://github.com/amir377 "amir377 (3 commits)")

---

Tags

frameworkWhmcsaddon

### Embed Badge

![Health badge](/badges/asamserver-wam/health.svg)

```
[![Health](https://phpackages.com/badges/asamserver-wam/health.svg)](https://phpackages.com/packages/asamserver-wam)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.7k509.9M17.0k](/packages/laravel-framework)[laravel/lumen-framework

The Laravel Lumen Framework.

1.5k26.2M709](/packages/laravel-lumen-framework)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[defstudio/pest-plugin-laravel-expectations

A plugin to add laravel tailored expectations to Pest

98548.9k4](/packages/defstudio-pest-plugin-laravel-expectations)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[doppar/framework

The Doppar Framework

366.7k8](/packages/doppar-framework)

PHPackages © 2026

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