Composer

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

If you have not used Composer before, please read Introduction first. PHPMaker uses Composer to manage required third party packages. Make sure you install Composer (if not already installed) when you install PHPMaker.

Composer is run by php.exe, so you need PHP installed on your PC. The PHP version on your PC should be the same as that on your development/production server.

A few sensitive PHP settings and compile flags are also required, when using the Composer installer you will be warned about any incompatibilities.

It is recommended that you upgrade your PHP to the latest stable version (v8.1.x as of today), download the version that suits your PC (x86 or x64). If you are not sure about Non Thread Safe or Thread Safe version, you may try the Non Thread Safe version first. Download the Zip version, which includes matching extensions for that version.

If you do not have php.ini yet, copy the php.ini-development and rename it as php.ini. Open the php.ini with a text editor, make sure AT LEAST the following are enabled:

When PHPMaker starts, it checks if Composer is ready, if not, it will ask you to install. Do not skip, just install. The installer (Composer-Setup.exe shipped with PHPMaker) will download composer for you and set up your PATH environment variable so that you can call composer from any directory after installation. During installation, the installer will try to find your php.exe. If the installer cannot find your installed php.exe automatically, you just specify it when asked.

After installation, open a command prompt and test Composer by entering:

If Composer is installed properly, you should see the version number, e.g. Composer version 2.3.10 2022-07-13 15:48:23. Make sure you have installed v2.3.9 or newer.

Note Close your current command prompt. Test usage with a new command prompt. This is important since the PATH only gets loaded when the new command prompt starts.

PHPMaker will then call composer update automatically after script generation to install/update libraries for your projects. After the FIRST generation, Composer needs to download all the required packages, it may take a longer time, please be patient. Later generation will not run "composer update" again unless you enable/disable some features that require third party packages.

Notes
  1. Composer downloads packages from the internet, make sure that you are online when you run "composer update".
  2. If you are using Composer from behind an HTTP proxy, you can use the standard http_proxy or HTTP_PROXY env vars, see http_proxy or HTTP_PROXY.
  3. The packages downloaded by Composer are put in the "vendor" subfolder under the project folder of your project. Make sure you upload this "vendor" subfolder to your site together with other generated files.

 

 ©2002-2023 e.World Technology Ltd. All rights reserved.