Valet-plus: Bug: Your Composer dependencies require a PHP version [ when using php 7.0 ]

Created on 3 Nov 2020  路  4Comments  路  Source: weprovide/valet-plus

  • [X] I've checked the issue queue and could not find anything similar to my bug.
  • [X] I'm on the latest version of valet-plus (valet --version): <Valet-Plus-Version>
  • [ ] I've run valet fix and valet install after updating and before submitting my issue/feature.

What is the problem?
For one of my customers I need to use php 7.0 because of the use of magento 2.1
But after I've installed php 7.0 using valet use 7.0 I get the error Your Composer dependencies require a PHP version ">= 7.2.0". You are running 7.0.33

What was supposed to happen?
valet -v should give valet version

What actually happened?
`Composer detected issues in your platform:

Your Composer dependencies require a PHP version ">= 7.2.0". You are running 7.0.33.%`

How to reproduce this?
Switch to php 7.0 after that valet won't work anymore

What is the solution?
That's why I asked this question

Sources

Bug Needs review

Most helpful comment

Sorry, issue still happening under 2.1.0. Please reopen.

The issue is triggered by Composer 2. Composer 2 has a minimum requirement of PHP 7.2.0

The issue is encountered under the following circumstances:

  • The user has composer 2 installed globally OR
  • The user has no composer installed globally. In this case Valetplus installs composer 2 globally by running brew install composer.

What is the solution?
Update step 5 in https://github.com/weprovide/valet-plus/wiki/Installation to:

Install Composer using Homebrew via brew install composer. Then downgrade Composer via composer self-update 1.10.17.


@MikeYV this is how you fix the problem if you already have Composer 2 installed. Then you can run valet use 7.2 again after running valet use 7.1 or valet use 7.0

# Downgrade Composer to version 1.10
composer self-update 1.10.17

# Update global Composer to remove global Composer dependencies to PHP 7.2
composer global update

If you want to run Composer 1 and Composer 2 next to each other, check out https://joostvanveen.com/a-40/run-composer-1-and-2-simultaniously.

All 4 comments

@MikeYV We've released version 2.1.0 which provides a composer.lock file. This should be solved.

This still happens for me under 2.1; please re-open.

Sorry, issue still happening under 2.1.0. Please reopen.

The issue is triggered by Composer 2. Composer 2 has a minimum requirement of PHP 7.2.0

The issue is encountered under the following circumstances:

  • The user has composer 2 installed globally OR
  • The user has no composer installed globally. In this case Valetplus installs composer 2 globally by running brew install composer.

What is the solution?
Update step 5 in https://github.com/weprovide/valet-plus/wiki/Installation to:

Install Composer using Homebrew via brew install composer. Then downgrade Composer via composer self-update 1.10.17.


@MikeYV this is how you fix the problem if you already have Composer 2 installed. Then you can run valet use 7.2 again after running valet use 7.1 or valet use 7.0

# Downgrade Composer to version 1.10
composer self-update 1.10.17

# Update global Composer to remove global Composer dependencies to PHP 7.2
composer global update

If you want to run Composer 1 and Composer 2 next to each other, check out https://joostvanveen.com/a-40/run-composer-1-and-2-simultaniously.

Composer docs for the 2.0 release indicate 2.0 is compatible with 5.6

2/ How easy is it to upgrade?

Our goal is that every Composer user can upgrade smoothly and swiftly. The gains are huge and we want everyone to benefit from them. To achieve that we did a few things:

Composer 2.0 still supports PHP 5.3 and above, much like Composer 1.x
composer.lock files are interoperable between versions, so you can upgrade to 2.0 and roll back easily if needed.
Most commands and arguments remain the same, and largely what you know about Composer remains true in 2.0.

On the other hand, it appears Valet+ 2.1 has a dependency that requires 7.1.3?

composer global update

Changed current directory to /Users/aclerkin/.composer
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
- weprovide/valet-plus 2.1.0 requires symfony/debug 4.4.8 -> satisfiable by symfony/debug[v4.4.8].
- weprovide/valet-plus 2.1.0 requires symfony/debug 4.4.8 -> satisfiable by symfony/debug[v4.4.8].
- symfony/debug v4.4.8 requires php ^7.1.3 -> your PHP version (5.6.40) does not satisfy that requirement.
- symfony/debug v4.4.8 requires php ^7.1.3 -> your PHP version (5.6.40) does not satisfy that requirement.
- Installation request for weprovide/valet-plus ^2.1 -> satisfiable by weprovide/valet-plus[2.1.0].

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eclectic-coding picture eclectic-coding  路  4Comments

perteraul picture perteraul  路  3Comments

mantebal picture mantebal  路  4Comments

aronwp picture aronwp  路  4Comments

kupoback picture kupoback  路  4Comments