Hi,
I have valet working perfectly for php71 on my osx.
When I switch to php56 and try to run my legacy project I get the following error:
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /Users/waveridingimac/.composer/vendor/tightenco/collect/src/Collect/Support/Collection.php on line 155
Call Stack:
0.0035 301136 1. {main}() /Users/waveridingimac/.composer/vendor/laravel/valet/cli/valet.php:0
0.0040 302744 2. require('/Users/waveridingimac/.composer/vendor/autoload.php') /Users/waveridingimac/.composer/vendor/laravel/valet/cli/valet.php:10
0.0045 318648 3. ComposerAutoloaderInit5d002e971497ad1863ab7c5d29971201::getLoader() /Users/waveridingimac/.composer/vendor/autoload.php:7
0.0127 524632 4. composerRequire5d002e971497ad1863ab7c5d29971201(???, ???) /Users/waveridingimac/.composer/vendor/composer/autoload_real.php:56
0.0131 529144 5. require('/Users/waveridingimac/.composer/vendor/tightenco/collect/src/Collect/Support/alias.php') /Users/waveridingimac/.composer/vendor/composer/autoload_real.php:66
0.0146 537624 6. class_alias(???, ???) /Users/waveridingimac/.composer/vendor/tightenco/collect/src/Collect/Support/alias.php:18
0.0146 537992 7. spl_autoload_call(???) /Users/waveridingimac/.composer/vendor/tightenco/collect/src/Collect/Support/alias.php:18
0.0146 538048 8. Composer\Autoload\ClassLoader->loadClass(???) /Users/waveridingimac/.composer/vendor/tightenco/collect/src/Collect/Support/alias.php:18
0.0147 538216 9. Composer\Autoload\includeFile(???) /Users/waveridingimac/.composer/vendor/composer/ClassLoader.php:322
I decided to reinstall valet while being on php56 and this is where I think the issue is:
sing version ^2.0 for laravel/valet
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- illuminate/container v5.6.7 requires php ^7.1.3 -> your PHP version (5.6.33) does not satisfy that requirement.
- illuminate/container v5.6.7 requires php ^7.1.3 -> your PHP version (5.6.33) does not satisfy that requirement.
- illuminate/container v5.6.7 requires php ^7.1.3 -> your PHP version (5.6.33) does not satisfy that requirement.
- Installation request for illuminate/container (locked at v5.6.7) -> satisfiable by illuminate/container[v5.6.7].
Installation failed, reverting ./composer.json to its original content.
Should valet be compatible with 5.6, please?
Thanks!
You've got something in your global composer config that's forcing a Laravel 5.6 requirement ... which itself requires PHP 7.1.3 or higher.
Switching to PHP 5.6 for Valet works just fine if php56 is installed and there are no conflicting dependencies. Simply:
valet stop
brew services start php56
brew link --overwrite php56
valet domain test
valet start
Note: running valet domain test is there to rebuild all site configs to point to the php56 socket. Substitute test with whatever other TLD you normally use, if needed.
Hi,
I'm sorry for late replay. I try to use it on a legacy Zend project that has nothing to do with any version of Laravel. When I refer to 5.6 I refer to php56, I did not make that clear.
The way it looks to me is that new valet requires "illuminate/container": "~5.1" and we are currently at version 5.6 of Illuminate container so this is what is being pulled with new valet installation.
The highest that worked with php56 was this one: https://github.com/illuminate/container/blob/5.4/composer.json therefore when you change php version, your valet installation will not work.
Correct me if I'm wrong, please.
I mentioned "Laravel 5.6" because your message mentioned "illuminate/container 5.6" ... which is part of Laravel 5.6
And, yes, illuminate/container 5.6 requires PHP 7.1.3 or higher.
To force older dependencies, you'll need to do a number of things:
php -v to determine which CLI version of PHP is currently active when using command-line (this affects composer). If that's not also PHP 5.6 then you'll need to update your PATH after ensuring brew link php56 was successful. Run composer global update ... which if you're using PHP 5.6 will hopefully calculate that it'll need an older version of many things including illuminate/container.
You might need to delete prior installed dependencies, such as rm -Rf ~/.composer/vendor/illuminate and then retry composer global update
You might need to remove some things from your ~/.composer/composer.json if they are conflicting or forcing a newer version of illuminate/container
I think this is probably an easy fix and just involves locking some dependencies lower. I'd definitely like to keep supporting 5.6 so I welcome a pull request to sort this out!
Resolved with #535
@aurawindsurfing #535 has not been merged yet, so this one's also not resolved (yet) ;)
Most helpful comment
I think this is probably an easy fix and just involves locking some dependencies lower. I'd definitely like to keep supporting 5.6 so I welcome a pull request to sort this out!