create-glpi-plugin
A GLPI plugin, with one command.
One command and a few questions. The result is a plugin that installs, shows up in the menu and has rights, a settings page, an item type with search and history, a cron task, tests and a release pipeline.
Terminal recordingThe questions, the choices and the files being written
Why
Writing a GLPI plugin is mostly ceremony before the first useful line, and most of that ceremony is undocumented: setup.php hook names, the namespace, one rights row per profile, where settings are stored, why search option IDs must never change.
Coding assistants do not know GLPI 11 either. They produce plugins from the GLPI 9 era that look right and fail in production. The generated scaffold ships a rulebook of GLPI 11 and 12 traps in the format each tool reads.
Features
Menu
An entry in the sector you choose (Plugins, Tools, Assets, Assistance, Management, Administration, Setup) with search, add and settings links, and an overview page that lists what was generated and the user's rights.
Settings
A settings page with three validated example fields. Defaults are added on update and never overwrite existing values.
Item type
A CommonDBTM class and table with a search-engine list, a form, history and entity support.
Cron and ticket tab
An automatic action with a parameter and a log, and a tab shown on every ticket.
AI coding rules
AGENTS.md for every agent, the full rulebook for humans and agents (docs/glpi-rules.md), CLAUDE.md and a skill for Claude Code, rules for Cursor. Each rule names the symptom you see when it is broken.
A ready toolbox
tests/lint.sh checks syntax and runs the "load check": it loads every plugin class against GLPI's core classes without booting GLPI. tools/package.py builds the tgz, zip and sha256 exactly as GLPI expects them.
How it works
There is no runtime; the output is a plain plugin folder.
Prompts or flags
The key, display name, GLPI versions, parts and AI tools are asked interactively or given as command-line flags.
Templates
Templates are plain files with a tiny syntax: {{key}}, {{#if menu}} … {{/if}}, {{#unless}}, {{else}}. A tag alone on its line disappears with the line, so the output has no gaps.
Conditional files
Always generated: setup, hook, Profile, Ui, the rulebook, tests, tools, workflows. Per feature: Menu, Config, Item, Cron, TicketTab and their pages. Per agent: CLAUDE.md, the skill, Cursor rules.
Plugin folder
The folder is written, a git repository is initialised and the first commit is made. What remains is to put it in GLPI's plugins directory and install it.
One codebase for GLPI 11 and 12
With the default option the generated code runs unchanged on both versions. Some of the differences it absorbs:
| Topic | GLPI 11 | GLPI 12 | Generated code |
|---|---|---|---|
| CSRF | Token field in every POST | Tokens removed | Renders the field only when needed; pages never call the check themselves |
| $rightname | Untyped | string | Never redeclared; canView() and friends are overridden |
| $dohistory | Untyped | bool | Never redeclared; set in the constructor |
| Access denied | Html::displayRightError() | Removed | An exception is thrown |
Installation
npx create-glpi-plugin # interactive
npx create-glpi-plugin myplugin --yes # defaults: GLPI 11+12, menu + settings
cp -r myplugin /var/www/glpi/plugins/
cd /var/www/glpi
php bin/console glpi:plugin:install myplugin -u glpi
php bin/console glpi:plugin:activate myplugin
On GLPI 12 the command is plugin:install myplugin -u glpi.
cd myplugin/docker && docker compose up -d
The plugin ships with a throw-away GLPI that installs itself in about a minute (http://localhost:8080).