Composer dependencies require a PHP version ">= 8.0.2"

Installing acorn with composer install roots\acorn in my local dev environments running php 7.4 causes the following error to show up unless I delete the dependency:

Fatal error : Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.0.2”. You are running 7.4.25. in /srv/www/wildatheart.org/current/vendor/composer/platform_check.php on line 24

According to the docs and Acorn’s composer.json file I should be able to run this in my php 7.4 environments without any trouble.

It looks like the php 8.0.2 requirement is coming from the following dependencies:

  • symfony/deprecation-contracts 3.0.1
  • symfony/event-dispatcher 6.0.3
  • symfony/event-dispatcher-contracts 3.0.1
  • symfony/string 6.0.3
  • symfony/translation 6.0.7
  • symfony/translation-contracts 3.0.1

Is there a version of Acorn I should install that supports 7.4, or will I need to upgrade to 8.0 to get this to work?

1 Like

Can you try the PHP 7.4 zip from the release?

Thanks that worked! Is there a good way to install that with composer, or do I need to keep it checked into mu-plugins?

1 Like

I think we need to look into this again because we had hoped that Acorn v2 could have PHP 7.4 support without having to do anything special besides composer require roots/acorn /cc @QWp6t

In the meantime, you could modify your composer.json file to grab the zip

Docs: Repositories - Composer

For those of us who are more composer-illiterate, can you explicitly tell us what to add to the composer.json file in order to reference https://github.com/roots/acorn/releases/download/v2.0.5/acorn-v2.0.5-php-7.4.zip ?

Otherwise, I first ran composer require roots/acorn, so acorn got added to my composer file. Then, I dumped my vendor directory and composer.lock file.
I then changed acorn ^2.0.5 to 2.0.3, ran composer install hoping this version would be compatible with php7.4.x, but there was still a dependency that required php v8.0.2.

I’m also unable to use Bedrock because this project will be on some typical shared host where I won’t have any say in the matter.

You should be able to read the docs or do some searches to figure it out. I’m more than happy to do it for you if you’re looking to hire me for my time.

1 Like

I added this to the composer.json repositories array:

{
      "type": "package",
      "package": {
        "name": "roots/acorn",
        "version": "2.0.5",
        "type": "wordpress-muplugin",
        "dist": {
          "url": "https://github.com/roots/acorn/releases/download/v2.0.5/acorn-v2.0.5-php-7.4.zip",
          "type": "zip"
        }
      }
    },

And added this to the dependencies:

    "roots/acorn": "^2.0"

I’m also unable to use Bedrock because this project will be on some typical shared host where I won’t have any say in the matter.

If you’re not using composer to manage plugins I’m not sure how this info will help though. I would think you could just install it on the site as a plugin.

Hope this helps!

1 Like