Skip to content

Instantly share code, notes, and snippets.

@PauloBoaventura
Forked from fprochazka/composer.php.ini
Created April 27, 2021 04:05
Show Gist options
  • Save PauloBoaventura/b8fe36a8cbcbb54d431cd8425a74c12a to your computer and use it in GitHub Desktop.
Save PauloBoaventura/b8fe36a8cbcbb54d431cd8425a74c12a to your computer and use it in GitHub Desktop.
Composer with different ini or with different PHP

Hacking Composer

When you wanna

  • use different version of PHP for Composer (or other CLI apps)
  • use different php.ini with Composer, because of for example slow XDebug (that you don't even need with production phar of Composer)

Usage

  • save composer.sh as /usr/local/bin/composer
  • save composer.php.ini as /usr/local/etc/composer.php.ini, or create your own ini
  • chmod +x /usr/local/bin/composer
  • profit

Mods

  • You can easily change the used PHP runtime by changing the php binnary to an absolute path
[php]
memory_limit = -1
max_execution_time = 0
date.timezone = "Europe/Prague"
realpath_cache_size = "4096K"
[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 256
opcache.max_accelerated_files = 65407
opcache.validate_timestamps = false # keep in mind to flush the cache, once you update composer
opcache.save_comments = true
opcache.load_comments = true
opcache.max_file_size = 0
#!/bin/bash
php -n -c /usr/local/lib/composer.php.ini /usr/local/bin/composer.phar $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment