helpscout / helpscout-api-php

PHP Wrapper for the Help Scout API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Your Composer dependencies require a PHP version ">= 8.1.0"

helgatheviking opened this issue · comments

commented
  • PHP version: 8.0
  • SDK version: 3.6.4

Current behavior

I am dabbling with updating my code to use the 3.0 API. I just tried to composer require helpscout/api "^3.0" and then require the autoloader via require_once 'vendor/autoload.php'; however, I am seeing the following fatal error

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.23. in /app/wp-content/plugins/woo3pdHelpscout/vendor/composer/platform_check.php on line 24

The only thing in my composer.json is the helpscout API

{
	"autoload": {
        "psr-4": {"Woo3pdHelpscout\\": "src/"}
    },
	"require": {
		"helpscout/api": "^3.0"
	}
}

The readme says that API 3.0 requires PHP 7.3 so it's not quite clear to me why I'd get errors about it requiring 8.1. It looks like symfony/deprecation-contracts requires PHP 8.1. And symfony/deprecation-contracts is required by guzzlehttp/guzzle.

Is this something fixable on this end, or is it something at Guzzle? Gotta profess I am not super fluent in Composer.

Hey @helgatheviking! I'm sorry your message slipped under our radar 😓

I've been trying your scenario and I can install version ^3.0 of our library in a machine with PHP 7.3 without problems.

You can see the process here:

CleanShot 2023-02-03 at 10 04 12@2x

As you see at the bottom, symfony/deprecation-contracts is being installed at version 2.5, which is fine with PHP 7.3. The version 3 of that library does require PHP 8, but our library requires only version 2 (through Guzzle as you say).

Looking at your repository and the error you're getting, my guess is you might have executed composer install in a machine with PHP 8.1 so it installed versions requiring 8.1. Then you committed your lock file specifying those versions, so when you're trying to run composer install in that machine with PHP 8.0, it fails...

My suggestion is removing the /vendor folder and the composer.lock file, then specify the PHP version you want to be compatible with in the platform requirements of your composer.json file, for example:

"config": {
  "platform": {
    "php": "8.0.23"
  }
}

Then you can run composer install again, and it should install the correct versions 👌

commented

Thank you! This seems to do the trick and resolves my fatal errors.