Build your first plugin
You will build Hello Pulse: a tiny plugin that returns a greeting when you open a URL. This teaches the full path from a file you edit to a result you can see. You do not need a game kit, Vue, a database table, or a marketplace account.
Finish local setup first. Use your local pulse-engine copy and
run the commands below from its top-level folder. Docker must be running and
the backend must already be installed and migrated.
1. Learn four words
| Word | What it means here |
|---|---|
| Plugin | A folder of code that adds a feature to Pulse. |
| Manifest | The plugin.json file that describes the plugin. |
| Route | A rule that connects a URL to some PHP code. |
| Controller | A PHP class that handles a request and returns a response. |
The request will travel through these pieces:
Your browser → plugin route → controller → JSON greeting
JSON is a text format for named values, such as "message": "Hello!".
Your browser may display it as one line or as a tree; both are fine.
2. Generate the starting files
First, check that your installed engine has the command:
docker compose exec backend php artisan help pulse:make:plugin
Then run:
docker compose exec backend php artisan pulse:make:plugin HelloPulse --api
The generator turns HelloPulse into the folder name hello-pulse. This
short identifier is called a slug. It also uses HelloPulse in PHP class
names. Letter case matters, so keep the names below exactly as written.
If the folder already exists, stop and inspect it. Do not add --force: that
option replaces the existing plugin folder.
Open these generated files in your editor:
File, inside backend/app/Plugins/hello-pulse/ |
Purpose |
|---|---|
plugin.json |
Identity, dependencies, permissions, and route settings. |
HelloPulsePlugin.php |
Entry point for the plugin's lifecycle. |
routes/api.php |
URL definitions. |
Controllers/Api/HelloPulseController.php |
PHP code that answers requests. |
hooks.php |
Place for reacting to engine events later. |
Other empty folders and generated documentation can stay as they are. We are using only the API files in this lesson. No frontend build is needed.
Checkpoint: backend/app/Plugins/hello-pulse/plugin.json exists.
3. Check the manifest
Open plugin.json. Keep the generated values, including:
{
"enabled": false,
"license_required": false
}
Inside requires, make sure the empty plugin dependency value is an object:
{
"requires": {
"laravel": ">=11.0.0",
"plugins": {}
}
}
pulse:make:plugin writes {}. Plugins scaffolded by older generators may
show "plugins": []; replace that value with {} to follow the plugin contract. There are no plugin dependencies in this lesson.
These valid JSON objects show only the fields to keep or merge into the existing
manifest; they are not complete manifests. Do not replace the whole file with
either object. Keep all other generated fields and commas between neighbouring
fields.
enabled: false is the starting state. Later, a command will enable the plugin
in Pulse's database registry. You do not need to change this value by hand.
4. Give the plugin one route
Replace all of routes/api.php with:
<?php
use App\Plugins\HelloPulse\Controllers\Api\HelloPulseController;
use Illuminate\Support\Facades\Route;
Route::get('/hello', [HelloPulseController::class, 'hello'])
->withoutMiddleware('auth:sanctum')
->name('hello-pulse.hello');
get means the route reads information. '/hello' is the final part of the URL.
Pulse supplies /api/plugins/hello-pulse automatically, so do not repeat it.
The route calls the controller's hello method.
Plugin API routes normally require a signed-in user. The
withoutMiddleware('auth:sanctum') line makes this particular greeting public.
It returns fixed text and exposes no player information. Pulse still checks
that the plugin is installed and enabled. Keep authentication on routes that
read player data or perform player actions.
5. Write the greeting
Replace all of Controllers/Api/HelloPulseController.php with:
<?php
namespace App\Plugins\HelloPulse\Controllers\Api;
use Illuminate\Http\JsonResponse;
use Illuminate\Routing\Controller;
class HelloPulseController extends Controller
{
public function hello(): JsonResponse
{
return response()->json([
'plugin' => 'hello-pulse',
'message' => 'Hello from my first Pulse plugin!',
]);
}
}
namespace tells PHP where this class belongs. hello() is the method the
route calls. response()->json(...) sends the named values back to the browser.
This method reads no player records and changes no game data.
6. Validate, register, and enable
Run these commands one at a time. Read each result before moving on:
docker compose exec backend php artisan hub:validate hello-pulse
docker compose exec -u www-data backend php artisan app:register-plugins
docker compose exec -u www-data backend php artisan hub:enable hello-pulse
docker compose exec backend php artisan hub:list --enabled
- Validate checks the manifest, required files, and compatibility. It does not prove that your PHP code works; the next step checks the actual request.
- Register records discovered plugins in
installed_plugins, Pulse's database registry. This scans the configured plugin folders; it updates a registered plugin whoseplugin.jsonchanged and skips the rest. - Enable switches this plugin on and clears its runtime caches.
- List should now include the slug
hello-pulseas enabled.
If validation fails, fix the reported problem before registering. If enable says the plugin is already enabled, check the list and continue.
Checkpoint: the enabled list contains hello-pulse.
7. See your result
Open this URL in your browser:
http://localhost:8010/api/plugins/hello-pulse/hello
Or run this in your terminal:
curl -i -H 'Accept: application/json' http://localhost:8010/api/plugins/hello-pulse/hello
You should get an HTTP 200 response with:
{"plugin":"hello-pulse","message":"Hello from my first Pulse plugin!"}
Change the message in the controller, save it, and refresh the URL. Seeing your new text confirms that your route reaches your code. This API lesson does not add a button or page to the player dashboard.
If something fails, use this short checklist:
| Result | First check |
|---|---|
| Connection refused | Complete local setup and check that the backend is running. |
404 |
Check the URL and hub:list --enabled; inspect the route below. |
401 |
Check that the route has the explicit public opt-out from step 4. |
403 with plugin_disabled |
Enable hello-pulse again. |
500 |
Check PHP spelling and backend/storage/logs/laravel.log. |
To inspect the loaded route:
docker compose exec backend php artisan route:list --path=api/plugins/hello-pulse
For more help, see troubleshooting.
8. Switch it off when finished
docker compose exec backend php artisan hub:disable hello-pulse
docker compose exec backend php artisan hub:list --disabled
This keeps your source files so you can return to the lesson. A fresh request
must no longer return the greeting successfully. To continue later, run
hub:enable hello-pulse again.
Next: Hooks by example →. When you want to add a player-facing view, read the plugin authoring overview and frontend SDK.
Source reference
This lesson follows backend/app/Core/Console/Commands/PulseMakePluginCommand.php
(generator), backend/app/Console/Commands/RegisterPlugins.php (registration),
backend/app/Core/Providers/PluginServiceProvider.php (routes and namespaces),
backend/app/Core/Services/PluginManagerService.php (enable/disable), and
plugin contract.