Composer
ForgeKit supports Composer for managing PHP dependencies.
Both Composer v2 and Composer v1 can be used, depending on your project.
Why multiple Composer versions?
Some older projects require Composer v1.
Modern projects use Composer v2.
ForgeKit allows both to exist without conflict. Both composer files are in /cli
How Composer works in ForgeKit
Composer runs using:
- The PHP binary of the active Instance
- The environment provided by ForgeKit
This avoids:
- System-wide PHP conflicts
- PATH issues
- Global Composer mismatches
In order to use the most of our built in composer files, we recommend you use ForgeKit's Terminal Integration
Using Composer
From the ForgeKit Terminal
fkit composer install
fkit composer update
fkit composer require package/name
For using version 1 of composer you can do:
fkit composer1 install
fkit composer1 update
fkit composer1 require package/name
To verify which PHP Composer is using:
fkit php -v
fkit composer --version
fkit composer1 --version
Common issues:
-
Composer memory errors Increase PHP memory limit in the Instance’s php.ini.
-
Composer uses wrong PHP Make sure you’re inside the ForgeKit terminal and the correct Instance is selected.