開發環境與工具


您可以使用任何開發環境。但是,這裏有一份高度推薦使用的工具清單,因為它們提供了較好的完整性、開發質量和開發效率。Dolibarr的大多數核心開發人員都在使用它們。請注意,所有這些解決方案都是免費和開源的。

Eclipsephp.jpg 適用於每個開發者

這是推薦的基本開發環境,但任何符合Web、PHP和MySQL標準的工具都可以做到這一點。

一個 AMP 伺服器

  • AMP 表示 Apache + MariaDB + PHP

Linux平台:默認情況下,這3個產品在所有發行版中都可用。

Windows平台: 安裝 [1] (基於MariaDB SQL database、Apache和PHP的組合軟件包) 。這個WAMP伺服器提供了MariaDB+Apache+PHP三個組件,只需單擊一下即可變更其中任何一個組件的版本。

瀏覽器 (Chrome / Firefox) + 插件

  • 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/

訪問數據庫的工具(SquirrelSQL 或 DBeaver)

  • SquirrelSQL or DBeaver for database administration.

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

IDE(Eclipse、VSCode)和插件

Eclipse

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.

VSCode

Voir les instructions d'installation de l'éditeur.

Git 鈎子

安裝預提交 git hook

您可以使用 git hooks 檢查您提交的文件的語法,並在發生錯誤時取消(或更好地自動修復)提交。

此文件中提供了安裝此類預提交掛鈎的說明:

https://github.com/Dolibarr/dolibarr/tree/develop/dev/setup/pre-commit

此類掛鈎在命令列上使用時可以工作,但在使用通用 IDE 提交時也可以工作(它已通過 Eclipse 和 VSC 進行了驗證)。

安裝後,該掛鈎將在您下一次提交時啟動以重新格式化您的程式碼,因此您的程式碼將始終符合編碼語法規則。如果每個人都啟用此鈎子,則每個人都將使用相同的編碼語法規則,因此強烈建議您盡可能啟用它。如果語法有問題,提交將立即取消。如果它可以自動修復,在安裝預提交掛鈎期間安裝的 phpcbf 將修復它,因此您只需再次嘗試提交即可驗證它。

Computer.png 可選組件

您還可以安裝可選組件以獲得更多技術支持。請參閱:開發環境與工具 - 可選組件