开发环境与工具

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search


您可以使用任何开发环境。但是,这里有一份高度推荐使用的工具清单,因为它们提供了较好的完整性、开发质量和开发效率。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 可选组件

您还可以安装可选组件以获得更多技术支持。请参阅:开发环境与工具 - 可选组件