Clone
1
templates-dolibarr
Jonathan Miller edited this page 2026-05-20 01:26:22 +00:00

← Back to Home

Template-Dolibarr Reference

Repository template for building Dolibarr ERP/CRM modules following MokoStandards. Scaffolds new module projects with a consistent directory layout, CI/CD workflows, build tooling, and governance files.


Type Dolibarr Module Template
Language PHP
License GPL-3.0-or-later
Repo Template-Dolibarr
Wiki Template-Dolibarr wiki

Purpose

Template-Dolibarr is the starting point for all new Dolibarr modules in the Moko Consulting ecosystem. It provides a fully scaffolded module with sample descriptor, admin pages, library helpers, language files, icons, PHPStan config, Transifex support, and Dolibarr update-server integration.

What the Template Provides

Component Description
Module source scaffold src/ with sample descriptor, admin, lib, langs, icons
Makefile Build, lint, test, package, install, release targets
CI/CD workflows 11 Gitea Actions workflows for the full module lifecycle
PHPStan config Static analysis preconfigured for Dolibarr development
Governance files LICENSE, CODE_OF_CONDUCT, CONTRIBUTING, GOVERNANCE, SECURITY
Update server update.txt for Dolibarr's built-in update checker
Documentation stubs Installation, development, changelog, module-id-policy guides

Quick Start

  1. Click Use this template on the Template-Dolibarr repo
  2. Rename sample files to match your module name:
Sample file Rename to
src/core/modules/modSample.class.php src/core/modules/modYourModule.class.php
src/lib/sample.lib.php src/lib/yourmodule.lib.php
src/langs/en_US/sample.lang src/langs/en_US/yourmodule.lang
src/sampleindex.php src/yourmoduleindex.php
  1. Update Makefile config:
MODULE_NAME    := yourmodule
MODULE_VERSION := 1.0.0
MODULE_NUMBER  := 500001    # Must be 500000+ for custom modules
  1. Edit the module descriptor class with your metadata
  2. Run make validate and make build

Makefile Targets

Target Description
make help Show all available targets
make install-deps Install Composer dev dependencies
make lint PHP syntax check
make phpcs PHP CodeSniffer (PSR-12)
make phpstan PHPStan static analysis
make validate Lint + phpcs checks
make test Run PHPUnit tests
make build Clean, validate, build ZIP
make install-local Install to local Dolibarr
make dev-install Symlink for live development
make release Full release pipeline

Workflows

Workflow Trigger Purpose
ci-dolibarr.yml Push Lint, PHPStan, structure validation
pr-check.yml Pull request PR validation checks
auto-release.yml Merge to main Release with ZIP, changelog, tag
pre-release.yml Push to dev Pre-release builds
publish-to-mokodolimods.yml Release created Publish to MokoDoliMods registry
update-server.yml Release created Update update.txt for Dolibarr
deploy-manual.yml Manual Deploy to target server
security-audit.yml Schedule/manual Dependency vulnerability audit
repo-health.yml Schedule Standards compliance check
cleanup.yml Schedule Clean old artifacts/branches
notify.yml Release/failure Event notifications

Directory Structure

Template-Dolibarr/
|-- .gitea/workflows/         # 11 CI/CD workflows
|-- src/                      # Dolibarr module source (deploy this)
|   |-- admin/                # Setup and about pages
|   |-- core/modules/         # Module descriptor class
|   |-- img/                  # Icons and logos
|   |-- langs/en_US/          # Language strings
|   +-- lib/                  # Module library helpers
|-- Makefile                  # Build system
|-- phpstan.neon              # Static analysis config
|-- composer.json             # PHP dependencies
+-- update.txt                # Version for Dolibarr updater

Key Wiki Pages

Page Description
Installation Installing and configuring a Dolibarr module
Development Development best practices
Module ID Policy Module ID assignment rules
Update Server How update.txt is managed


Repo: moko-platform · moko-platform wiki

Field Value
Minimum Version 04.07.00
Platform dolibarr
Applies To Dolibarr module repositories
Revision Date Author Description
1.0 2026-05-19 Moko Consulting Initial version