Environment and development tools

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search


Every integrated development environment can be used. However, this is a list of tools highly recommanded to use. They are all famous and a good help as they are featurful and of high quality. They are used by most main Dolibarr developers. Above all, they are all free and Opensource.

Eclipsephp.jpg For every developer

These are the recommended tools but any tool compliant with PHP, MySQL and Web standards can be used.

An AMP server

  • AMP means Apache + MariaDB + PHP

For Linux: These 3 products are available in almost all Linux distributions by default.

For Windows: Install [1] (MariaDB SQL database, Apache and PHP in an all-in-one package) or a comparable system environment (like XAMPP).

The WAMP server offers MariaDB+Apache+PHP, with the option to change the version of any component with a simple click.

Webbrowser (Chrome / Firefox) + plugins

  • Chrome + plugins

You can download Chrome from https://www.chrome.com

  • Firefox + plugins:
    • HTML Validator
    • User Agent Switcher to simulate usage of smartphones
    • Cert Viewer Plus if you plan to make tests with HTTPS
    • QuickProxy if you want to switch quickly on proxy tools (WebScarab)

You can download this on web site https://www.firefox.com

or the new Firefox Developer Edition: https://www.mozilla.org/de/firefox/developer/

A database administration tool

Using a heavy database manging client is more productive than using web tools like phpmyadmin. For such a client, you can try

  • SquirrelSQL
  • DBeaver

Go on official web site of this product to download them.

Eclipse and plugins

Install Eclipse

We recommend to use an Eclipse version provided on eclipse.org. For example: https://eclipse.org/pdt/

Also any version available on Eclipse web site is possible.

Once Eclipse is installed, it is recommanded to setup following parameters:

  • Window - Preferences - General - Workspace - Text file encoding -> UTF8
  • Window - Preferences - General - Workspace - New text file line delimiter -> Unix
  • Window - Preferences - General - Compare/Patch - Ignore white spaces -> Yes
  • Window - Preferences - General - Editor - Text editors - Tab delimiter length -> 4
  • Window - Preferences - General - Editor - Text editors - Insert spaces for tab -> No
  • Window - Preferences - General - Editor - File Association -> Add *.lang associated to "Text Editor"
  • Note: You can also disable Windows - Preferences - Java - Editor - Content Assist - Auto Activation

And if PDT is installed (see later):

  • Window - Preferences - PHP - Code Style - Formatter - Tab policy -> Tab
  • Window - Preferences - PHP - Code Style - Formatter - Default indentation for wrapped line -> 1
  • Window - Preferences - PHP - Code Style - Formatter - Default indentation for array initializer -> 0
  • Window - Preferences - PHP - Editor - Typing - Uncheck "When Pasting Adjust Indentation" (keeping this option checked create corruption of text files by adding bad end of line characters)
  • Window - Preferences - PHP - Code Style - Formatter - Use the profile provided into dev/setup/eclipse/PSR-12 [built-in].xml as Eclipse syntax formatter.
  • Note: You can also disable Windows - Preferences - PHP - Editor - Content Assist - Auto Activation

Install plugin Eclipse for PHP: PDT.

If you installed Eclipse version and PDT is not included, all you have to do is using process Help -> Install new software -> Add -> Archive to add module:

https://download.eclipse.org/releases/xxx - xxx = version

Or from the GUI of any Eclipse =>Install New Software =>Work With Kepler => Wait until list display =>General Purpose Tools Check PHP development tools (PDT)=>Install

Once installed, you must also setup PDT into Eclipse as explained into chapter Environment_and_development_tools_-_Optionnal_components#From_Eclipse

Setup Eclipse to get sources

Once Eclipse is installed, you can connect to GIT repository to get last development version.

For this see page FAQ Get,update GIT project sources.

Git Hooks

Install Pre-commit githook

You can use git hooks to check the syntax of the file you commit and cancel (or better autofix) the commit if something is wrong. You need phpcs command line tool for this (sudo apt-get -y install php-codesniffer). If you have phpcbf installed, you can also fix the files automatically. This is how to:

Go to /dev/setup/git/hooks of your local repository, copy the file pre-commit into your .git/hooks folder of the local git repository and make it executable.

Next, you need to edit pre-commit file in .git/hooks to modify the DIRPHPCS variable to set the path of your phpcs and phpcbf tool (you can keep it empty if tools are available into your PATH).

Such hooks will work when using on command line but may also work when committing using your common IDE (it has been validated with Eclipse and VSC).

Once installed, the hook will start on your next commit to re-format your code, so your code will always match the coding syntax rules. If everybody enable this hook, everybody will use the same coding syntax rule, so it is highly recommended to enable it if you can. If something is wrong in the syntax, the commit will be immediately canceled. If it can be fixed automatically, phpcbf will fix it so you just have to try the commit a second time to have it validated.

Computer.png Optional

There are a lot of more components you can install to get more technologies support: Environment and development tools - Optionnal components