Welcome to the NZRT Wiki Podcast. Today we’re looking at 💼 Dolibarr GitHub Integration.
So, what is this integration all about? At NZRT, Dolibarr is the ERP system — the business backbone — and GitHub is where all the code lives. This integration ties the two together in several important ways. You get automatic code deployment from GitHub straight to the Dolibarr server, product and customer data syncing between WordPress and Dolibarr, a feature flag system that lets GitHub Actions turn Dolibarr features on or off, and a full audit trail so every sync event gets logged.
Let’s start with the module structure. The custom Dolibarr code lives in a folder called dolibarr-custom. Inside that, you have a source folder containing a modules directory with three submodules. The first is wp-sync, which handles the WordPress synchronisation and contains class files for products and webhooks, an admin setup file, a triggers file, and the main module file. The second is nzrt-audit, which handles audit logging through a class called AuditLog. The third is nzrt-reports for reporting. Alongside the modules, there’s a shared functions file, a dot-env file for environment variables, and a GitHub Actions workflow file for deployment automation.
Now let’s talk about how WordPress and Dolibarr actually talk to each other. When a product is updated in WordPress, WordPress sends a webhook — essentially a POST request — to a specific endpoint on the Dolibarr server. That request carries a payload containing the event type, the product ID, the product name, the price, the SKU, any image URLs, and a sync key to verify the request is legitimate.
On the Dolibarr side, there’s a PHP handler that receives that incoming data. It reads the raw request body, decodes the JSON payload, and then verifies the request is authentic by computing a cryptographic signature using a secret key and comparing it to the signature sent in the request header. If those don’t match, the handler rejects the request immediately with an unauthorised response. If they do match, it hands the event off to the product sync class, which does the actual synchronisation work, and returns a success or failure response.
Next up is the GitHub Actions deployment workflow. This is what makes sure that whenever you push code to the main branch on GitHub, your Dolibarr customisations get deployed automatically. The workflow runs on a Linux environment and goes through several steps. First it checks out your code, then it sets up PHP version 8.1 with the MySQL, curl, and JSON extensions. After that it installs any Composer dependencies, excluding development ones, and runs your test suite. Once tests pass, it handles the actual deployment. It sets up an SSH key stored as a GitHub secret, scans the Dolibarr host to verify its fingerprint, and then copies the module files from your source folder directly to the custom modules directory on the Dolibarr server. After deploying, it clears the Dolibarr cache by removing temporary cache files over SSH. Finally, regardless of whether the deployment succeeded or failed, it sends a Slack notification so your team knows the outcome straight away.
The last piece to understand is the feature flag system. This is a lightweight way to turn functionality on or off without changing code. There’s a helper function that reads an environment variable called FEATURE FLAGS, which contains a JSON object — a simple list of feature names paired with true or false values. The function looks up any feature by name and returns whether it’s active. For example, the environment variable might have advanced reporting set to false, audit log set to true, and custom export set to false. In practice, code throughout the Dolibarr modules can call that function before loading a feature, so you can safely ship code that’s switched off until you’re ready.
Pulling it all together — you have GitHub as your source of truth for code, an automated pipeline that deploys and tests on every push, a webhook bridge keeping your product data in sync between WordPress and Dolibarr, and a feature flag layer giving you fine-grained control over what’s live at any given time. It’s a clean, auditable setup that keeps your ERP and your codebase tightly coordinated.
That’s it for this episode of the NZRT Wiki Podcast. Thanks for listening.