Scaffold
Generate a new Fleetbase extension from the starter template using `flb scaffold`.
flb scaffold
Generate a new Fleetbase extension from the fleetbase/starter-extension template. The CLI clones the template, prompts for your extension's name and metadata, then refactors namespaces, package names, and class names so it's ready to develop against immediately.
flb scaffoldYou'll be prompted for the extension name, description, author, email, keywords, PHP namespace, and repository URL. Hit enter to accept defaults.
Options
| Option | Description |
|---|---|
-p, --path <path> | Where to scaffold (default: current directory) |
-n, --name <name> | Extension name |
-d, --description <description> | Description |
-a, --author <author> | Author name |
-e, --email <email> | Author email |
-k, --keywords <keywords> | Comma-separated keywords |
-n, --namespace <namespace> | PHP namespace (auto-prefixed with Fleetbase\) |
-r, --repo <repo> | Repository URL (default: the starter template repo URL) |
Anything you don't pass is asked for interactively.
Example
flb scaffold \
--name "Vehicle Inspections" \
--description "Pre-trip and post-trip vehicle inspection workflows" \
--author "Acme Logistics" \
--email "engineering@acme.com" \
--keywords "fleet,inspections,compliance"Or just run flb scaffold and answer the prompts.
What Gets Generated
The CLI clones the starter into a kebab-cased folder named after your extension (e.g. vehicle-inspections/). If a folder of that name already exists, it appends -1, -2, etc. until it finds a free name.
It then:
- Updates manifests —
extension.json,package.json,composer.jsonare rewritten with your name, description, author, keywords, and computed package names. - Renames the engine class —
addon/engine.jsswapsStarterEnginefor your<Name>Engineclass and registers the menu item under your display name. - Renames PHP files —
StarterResourceController.phpbecomes<Name>ResourceController.php, the service provider is renamed, and the config and routes files are updated. - Refactors namespaces — every PHP file under
server/has itsnamespaceandusestatements rewritten from the starter'sFleetbase\Starter\…to yourFleetbase\<YourName>\….
Computed Names
Given the inputs --author "Acme Logistics" --name "Vehicle Inspections", the scaffolder produces:
| Asset | Value |
|---|---|
| Folder | vehicle-inspections/ |
| Engine class | VehicleInspectionsEngine |
| PHP namespace | Fleetbase\VehicleInspections |
| npm package | @acme-logistics/vehicle-inspections-engine |
| Composer package | acme-logistics/vehicle-inspections-api |
The author name is normalized — common company suffixes (LLC, Pte Ltd, Inc, Corp, GmbH, Limited, Ltd) are stripped before being used in package names.
Next Steps
Once the scaffold finishes:
cd vehicle-inspections
# Link the addon into your Fleetbase console
cd ../fleetbase/console
pnpm link ../vehicle-inspections
# Link the API package into your Fleetbase api
cd ../api
composer config repositories.local path ../vehicle-inspections/server
composer require acme-logistics/vehicle-inspections-api:dev-mainFor the full development workflow (Ember serve, Laravel migrations, Universe service registration), see the Extension Development.
Troubleshooting
Error scaffolding extension: … — usually a network failure on git clone or a permissions issue writing to the target path.
The folder name already exists — the scaffolder auto-appends a counter (-1, -2, …). If you want to overwrite, delete the existing folder first.