Getting Started
v1.0
This guide takes you from zero to a working module in under 5 minutes using the built-in scaffold command.
Prerequisites
- ChargePanda installed and running
- PHP 8.1+
- Composer (no extra packages required — the module system ships with ChargePanda)
1. Scaffold your module
Run the artisan command with your module name in StudlyCase:
php artisan module:make MyPluginThis creates the following structure under modules/MyPlugin/:
modules/MyPlugin/
├── module.json
├── ModuleServiceProvider.php
├── Http/
│ └── Controllers/
├── Models/
├── database/
│ ├── migrations/
│ └── seeders/
├── resources/
│ └── views/
└── routes/
├── web.php
└── api.php2. Review module.json
Open modules/MyPlugin/module.json. It was pre-filled by the scaffold:
{
"name": "My Plugin",
"slug": "my-plugin",
"version": "1.0.0",
"description": "",
"author": "",
"requires": {
"chargepanda": ">=1.0.0"
},
"enabled": true
}The slug is used as the view namespace, config key, and URL prefix by convention. Keep it lowercase and hyphenated.
3. Install the module
Register your module in the database so ChargePanda boots it on every request:
php artisan module:install MyPluginThis inserts a row into the modules table with status active. From this point on, your ModuleServiceProvider is booted automatically.
Tip: You can also install modules through the admin UI at Admin → Modules by uploading a ZIP of the module folder.
4. Verify it loaded
php artisan module:listYou should see MyPlugin listed as active.
5. Add your first route
Open modules/MyPlugin/routes/web.php and add:
Route::get('/hello', function () {
return 'Hello from MyPlugin!';
})->name('my-plugin.hello');Then tell your service provider to load web routes. Open modules/MyPlugin/ModuleServiceProvider.php:
public function boot(): void
{
$this->loadWebRoutes();
$this->loadViews();
}Visit /hello in your browser. You should see "Hello from MyPlugin!".
6. Enable / disable without deleting
In the admin UI (Admin → Modules) you can deactivate a module without uninstalling it. A deactivated module's service provider is not booted, so its routes, migrations, and listeners are all offline.
Click Activate or Deactivate next to the module. The change takes effect on the next page request — no server restart needed.
To check current status from the command line:
php artisan module:list7. Reinstall a module
If you accidentally deleted a module's product or plans — or need to re-run its setup seeder — use the Reinstall button in Admin → Modules.
Reinstall clears the module's setup_complete flag and re-fires the ModuleActivated event, causing the setup seeder to run again. Seeders use firstOrCreate, so only missing records are created — existing data is not overwritten.
Next steps
- Module Structure — understand every file in depth, including asset linking and module dependencies
- Admin Integration — add your module to the admin sidebar
- Account Integration — add pages to the customer account area