title: Use different PHP version CLI executable for one command
body: <p>So I have Gentoo box with three PHP versions installed (nevermind the reasons):</p>
  
  <ol>
  <li><code>/usr/bin/php</code> -> <code>/usr/lib64/php5.4/bin/php</code></li>
  <li><code>/usr/bin/php5.5</code> -> <code>/usr/lib64/php5.5/bin/php</code></li>
  <li><code>/usr/bin/php5.6</code> -> <code>/usr/lib64/php5.4/bin/php</code></li>
  </ol>
  
  <p>I want to install <a href="http://laravel.com">Laravel framework</a> using composer:</p>
  
  <pre><code>$ composer create-project laravel/laravel --prefer-dist
  </code></pre>
  
  <p>This however throws an error because Laravel requires PHP > 5.5.9 and the default <code>php</code> interpreter is <strong>5.4</strong>.
  So I issue another command:</p>
  
  <pre><code>$ /usr/bin/php5.6 /usr/bin/composer create-project laravel/laravel --prefer-dist
  </code></pre>
  
  <p>This takes me one step further, but then some post-install commands from Laravel's <code>composer.json</code> comes into play, and installation crashes.</p>
  
  <p>This is due to the fact, that <code>composer.json</code> commands look like this:</p>
  
  <pre><code>"post-install-cmd": [
      "php artisan clear-compiled",
      "php artisan optimize"
  ],
  </code></pre>
  
  <p>As you can see, the "default" interpreter is used again!</p>
  
  <p>Now, proper PHP files start with following shebang:</p>
  
  <pre><code>#!/usr/bin/env php
  </code></pre>
  
  <p>This is nice feature as PHP interpreter can be found under different locations on different systems.
  Unfortunatelly, in this case <code>env</code> command returns path to the first executable it finds in <code>$PATH</code> environmental variable.</p>
  
  <p>How could I possibly alter current session environment or what kind of trick to perform so for the execution of whole Laravel installation process <code>php</code> command would invoke <code>/usr/bin/php5.6</code> instead of <code>/usr/bin/php</code>?</p>
  
  <p>I don't want to change <code>$PATH</code> variable or modify files like <code>composer</code>, <code>composer.json</code> or Laravel's CLI utility <code>artisan</code>.</p>
  
  <hr>
  
  <p>Edit: also assume that I want to do this from regular user account (i.e. with no root permissions).</p>