Composer is a dependency management tool for PHP. It allows you to manage the libraries your project depends on and runs updates on these dependencies for you.
Composer is now installed on all Managed Servers and uses the PHP configuration and version specified in the PHP Config tool in konsoleH.
You can choose between two methods of installing dependencies:
1. The first method is more simple and can be used when getting started. Run this command in your public_html directory:
composer require <module>
e.g. composer require monolog/monolog
This will install the module and its dependencies into your current folder and create a file “vendor/autoload.php” which can then be included in your code to give access to the dependency
2. The second way to install dependencies is to use a provided composer.json file (often included with software such as some WordPress installers) or to create your own. A more detailed explanation can be found here.
To obtain information about installed dependencies:
- To get information about dependencies installed by Composer, simply run:
To uninstall dependencies:
- Run this command:
composer remove <module name>
e.g. composer remove monolog/monolog