Composer

Switching between version 1 and 2 of composer

composer self-update --1
composer self-update --2 

Disable composer's memory limit

If you get PHP Fatal error: Allowed memory size of 123456789 bytes exhausted (tried to allocate 4096 bytes) in… the following might be the solution.

# set a high memory limit
php -d memory_limit=3G composer update
 # or completely disable php memory limit
php -d memory_limit=-1 composer require xyz/def
 # or whatever composer command you want.

Note: Depending on your environment you may need to use the full path to php or composer like `/usr/local/bin/composer`.

Get the root directory of composer vendor packages within PHP script

// get composer vendor directory
$reflection = new \ReflectionClass(\Composer\Autoload\ClassLoader::class);
$vendorDir = dirname(dirname($reflection->getFileName()));
Feedback
Wir bearbeiten Dein Feedback aus diesem Formular über gitlab.com – Du kannst das E-Mail Feld leer lassen, falls Du keine Antwort von uns erwartest. Alternative Kontaktmöglichkeiten findest Du im Impressum.