SmarMaker - Documentation
Docs» en» en:back:start

**This is an old revision of the document!**

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:

  • mobile: the folder that will contain all the source code for the mobile part (front end in React, see below)
  • pwa : the folder where the contents of the “compiled” mobile application will be copied, as well as the api.php entry point.
  • smartmaker-api: the folder in which you will store the php controllers and mappers for your objects, which will be accessible via the api.php router in the pwa folder. As well as a smartmaker-api-prepend.php file which is used to factorise code and avoid having overly verbose php headers. ##Mapping dolibarr <-> application react Dolibarr objects can't be directly transposed into react, so we've developed a mapping system that allows you to map dolibarr objects to 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 <ignore><-> react</ignore>]] ##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: * Route::action * action can be get post or put (delete is not yet implemented) * the 1st argument of the function is the name of the entry point you want on your api, so Route::get('login' corresponds to the http request GET /login. * the next argument gives the name of the PHP class to be requested * the next argument contains the name of the function to be used in this PHP class * the last argument indicates whether this is a route for which authentication is required or not 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 and a POST /login calls the login function of the 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` class …
	/**
	 * @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

Previous Next

SmarMaker - Documentation
This translation is older than the original page and might be outdated. See what has changed.
Translations of this page:
  • Français
  • Deutsch
  • English
  • Español
  • Italiano
  • Nederlands

Table of Contents


  • SmartMaker
    • SmartAuth
    • Back (PHP)
    • Front (React)
    • SmartCommon
    • HowTo first app
  • Formations
  • Démonstration
  • Show pagesource
  • Old revisions
  • Backlinks
  • Back to top
  • Log In
en/back/start.1756894416.txt.gz · Last modified: 2025/09/03 10:13 by caprel