gecka / composer-installer-dolibarr
Composer installer for Dolibarr modules. Routes packages of type dolibarr-module to htdocs/custom/{name}/.
Package info
github.com/Gecka-Apps/composer-installer-dolibarr
Type:composer-plugin
pkg:composer/gecka/composer-installer-dolibarr
Requires
- php: >=8.1
- composer-plugin-api: ^2.0
- composer/semver: ^3.0
Requires (Dev)
- composer/composer: ^2.2
- laravel/pint: ^1.0
- pestphp/pest: ^3.0
- phpstan/phpstan: ^2.1
README
Composer plugin that installs Dolibarr modules from any Composer repository (Packagist, Satis, VCS) into the standard custom/ directory.
Pair with gecka/dolibarr-module-modulemanager for an in-Dolibarr UI on top, or use it standalone from the CLI.
Features
- Standard
custom/layout — Packages of typedolibarr-moduleland incustom/<name>/relative to yourcomposer.json. - Single flat vendor — Module PHP dependencies share one
vendor/tree, resolved once. Surfaces version conflicts at install time, not at runtime. - Dolibarr version guard — Modules can declare
extra.dolibarr.min_version/max_version; the installer reads the running Dolibarr version fromversion.inc.phpand refuses incompatible installs before any download. - Configurable target name —
extra.dolibarr.namelets module authors override the default name derived from the package. - Zero-config for callers — Add the plugin to your root
composer.jsonandcomposer require <module>does the right thing.
Requirements
- PHP 8.1 or newer
- Composer 2.x
Installation
From your Dolibarr htdocs/ directory:
composer init # only if you don't already have a composer.json
composer require gecka/composer-installer-dolibarr
That's it. The plugin is now active for the project.
Usage
Install any Dolibarr module published as a Composer package:
composer require <vendor>/dolibarr-module-<name>
The module's files land in custom/<name>/. Activate the module the regular way through Dolibarr's Setup > Modules page.
To remove it:
composer remove <vendor>/dolibarr-module-<name>
For module authors
See CONVENTION.md for the packaging convention your module needs to follow to be installable through this plugin.
How it works
Composer resolves the root composer.json and routes every package whose type is dolibarr-module through this installer. The installer computes the target directory as follows:
- If the package declares
extra.dolibarr.name, use it verbatim. - Else, strip the
dolibarr-module-prefix from the suffix of the package name (gecka/dolibarr-module-foobecomesfoo). - Else, fall back to the suffix as-is.
The resolved name is validated against path-traversal and filesystem-unsafe characters before being used.
Development
composer install composer test # run Pest test suite composer lint # check coding style (Pint) composer fix # apply coding style fixes
License
MIT, see LICENSE.
Authors
Laurent Dinclaux laurent@gecka.nc — Gecka
Built with 🥥 and ☕ by Gecka — Kanaky-New Caledonia 🇳🇨