Open source
GLPI · CLI

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.

TypeGLPI · CLI
CompatibilityGLPI 11 · 12
LanguageJavaScript
LicenceMIT
Latest releasev0.1.1
ToolNode.js 20 or newer
Generated pluginPHP 8.2 (GLPI 11), 8.3 (GLPI 12)
Screenshots 1 / 2

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.

  1. Prompts or flags

    The key, display name, GLPI versions, parts and AI tools are asked interactively or given as command-line flags.

  2. 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.

  3. 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.

  4. 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:

TopicGLPI 11GLPI 12Generated code
CSRFToken field in every POSTTokens removedRenders the field only when needed; pages never call the check themselves
$rightnameUntypedstringNever redeclared; canView() and friends are overridden
$dohistoryUntypedboolNever redeclared; set in the constructor
Access deniedHtml::displayRightError()RemovedAn exception is thrown

Installation

Generate the scaffold
npx create-glpi-plugin                  # interactive
npx create-glpi-plugin myplugin --yes   # defaults: GLPI 11+12, menu + settings
Install into GLPI
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.

No GLPI at hand
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).

Source code, releases and full documentationgithub.com/CodeByPinar/glpi-plugin-cli
Open on GitHub
open to new projectsLet's work together