Table des matières

DoliMobile - Back (PHP)

The dolimobile back office must be integrated into a normal dolibarr module.

So when you deploy dolimobile in your dolibarr module you will have a few new folders that will appear:

As well as a file smartmaker-api-prepend.php which is used to factorise code and avoid having php headers that are too verbose.

Mapping dolibarr <-> react application

Dolibarr objects can't be directly transposed into react, so we've developed a mapping system that matches dolibarr objects with their react equivalent.

Each dolibarr class that needs to be mapped can be mapped using a set of fine-tuned techniques, details of which can be found below.

For example, for the dolibarr Company object you will find a dmCompany class in the smartAuth project.

If your module provides a SmartInter object, for example, you can map its fields to react simply by implementing a dmSmartInter file.

More details on the mapping_dolibarr_-_react

api.php file

This is where you implement the various entry points to the API dedicated to your application.

The PHP router

This php router includes the following grammar:

This PHP router makes it extremely easy to 'track' the various actions possible on your API!

For example, a GET /login calls the index function of the AuthController class class and a POST /login calls the login function of this same class …

Route::get('login', AuthController::class, 'index');
Route::post('login', AuthController::class, 'login');

Want to implement a logout? It's easy: add a line to api.php

Route::post('logout', AuthController::class, 'logout', true);

And implement the logout function in your AuthController

	/**
	 * @api {post} /logout Logout
	 * @apiDescription Logout and close session
	 * @apiName PostLogout
	 * @apiGroup Auth
	 *
	 */
	public function logout($payload)
	{

Note: this function is of course already implemented natively in DoliMobile