miladyousefi/whmcs
Composer 安装命令:
composer create-project miladyousefi/whmcs
包简介
Framework for creating WHMCS addon modules.
关键字:
README 文档
README
WAM is a powerful framework designed to simplify the creation and management of WHMCS addon modules. It provides a structured approach with modern PHP practices and helpful CLI commands.
Installation
To create a new WHMCS addon module, use Composer:
composer create-project asamserver/wam your-addon-name dev-main
This will create a new directory with your addon name and install all necessary dependencies.
Directory Structure
After installation, your project will have the following structure:
your-addon-name/
├── app/
│ ├── Controllers/
│ ├── Dispatcher/
│ ├── Helper/
│ └── Models/
├── commands/
├── database/
├── resource/
│ ├── css/
│ ├── js/
│ └── views/
└── routes/
Available Commands
WAM comes with several CLI commands to help you build your addon module:
1. Create Addon Module
php whmcs make:addon YourAddonName
This command will:
- Create the main addon file
- Set up the basic directory structure
- Generate necessary dispatcher files
- Create a base controller
- Set up routing configuration
Output:
Created app directory: /path/to/your/addon/app
Created addon file: /path/to/your/addon/YourAddonName.php
Created Application file: /path/to/your/addon/app/Application.php
Created Helper directory: /path/to/your/addon/app/Helper
Created helper file: /path/to/your/addon/app/Helper/Helper.php
Created adminDispatcher directory: /path/to/your/addon/app/Dispatcher
Created AdminDispatcher file: /path/to/your/addon/app/Dispatcher/AdminDispatcher.php
Created AdminDispatcher file: /path/to/your/addon/app/Dispatcher/ClientDispatcher.php
Created Router file: /path/to/your/addon/app/Router.php
Created BaseController directory: /path/to/your/addon/app/Controllers
Created BaseController file: /path/to/your/addon/app/Controllers/BaseController.php
2. Create Controller
php whmcs make:controller Admin/DashboardController
Creates a new controller with basic structure and routing.
Output:
Created controller: /path/to/your/addon/app/Controllers/Admin/DashboardController.php
3. Create Model
php whmcs make:model User
Generates a new Eloquent model class.
Output:
Created model: /path/to/your/addon/app/Models/User.php
4. Create Migration
php whmcs make:migration users
Creates a new database migration file.
Output:
Created database directory: /path/to/your/addon/database
Created migration file: /path/to/your/addon/database/YYYY_MM_DD_HHMMSS_create_users_table.php
5. Create Environment File
php whmcs make:env
Creates a .env file from .env.example if it doesn't exist.
Output:
.env file successfully created from .env.example
Configuration
Environment Variables
The following environment variables can be configured in your .env file:
MODULE=YourAddonName AUTHOR=Your Name VERSION=1.0.0 APP_ENABLE=true DELETE_TABLES=false
Routes
Define your routes in routes/web.php:
return [ // Admin routes 'admin/dashboard' => [ 'controller' => DashboardController::class, 'action' => 'index', ], // Client routes 'client/dashboard' => [ 'controller' => ClientDashboardController::class, 'action' => 'index', ], ];
Views and Assets
Views
Place your view files in resource/views/. The BaseController provides a renderView method:
public function index() { return $this->renderView('dashboard', [ 'title' => 'Dashboard', 'data' => $someData ]); }
CSS and JavaScript
- CSS files go in
resource/css/ - JavaScript files go in
resource/js/ - Access them using
renderCss()andrenderJs()methods in BaseController
Helper Functions
The framework provides several helper functions in app/Helper/Helper.php:
generateRandomNumber(): Generates a random numbergetClientId(): Gets the current client IDgetControllerClass(): Gets the fully qualified controller class name
Best Practices
- Always use the provided CLI commands to generate new files
- Follow PSR-4 autoloading standards
- Use migrations for database changes
- Keep controllers thin and move business logic to models
- Use environment variables for configuration
- Follow WHMCS security best practices
Requirements
- PHP >= 8.0
- WHMCS installation
- Composer
Dependencies
The framework includes:
- illuminate/database
- symfony/console
- vlucas/phpdotenv
License
This project is licensed under the MIT License.
miladyousefi/whmcs 适用场景与选型建议
miladyousefi/whmcs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 28 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 11 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Whmcs」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 miladyousefi/whmcs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 miladyousefi/whmcs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 miladyousefi/whmcs 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
WHMCS API for Laravel 5
Whmcs Addon Admin Page Controller
WHMCS API PHP-Wrapper bundled as a composer package
Make easy develop addon for WHMCS marketplace 😱
Generate a spesific username and password for ftp,whm etc. by domain and prefix
统计信息
- 总下载量: 28
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-20