Require mvc skeleton with composer and PHP 8

A client of mine already uses the latest released stable version of PHP (PHP 8). If I 'm trying to install the laminas mvc skeleton, it always ends up with an error.

[InvalidArgumentException]
Could not find package laminas/laminas-mvc-skeleton with stability stable in a version installable using your PHP version, PHP extensions and Composer version.

I 'm using the composer command from the laminas docs.

composer create-project -s dev laminas/laminas-mvc-skeleton path/to/install

What is the most common workaround to install the laminas mvc skeleton with PHP 8 and composer?

Hello @ezkimo! You can add the --ignore-platform-reqs parameter when creating the project with composer.
composer create-project -s dev laminas/laminas-mvc-skeleton path/to/install –ignore-platform-reqs

I hope this helps you.

Thank you very much, @jeferson. This answer helped a lot.

To get a deeper understanding why most of the Laminas components actually are not installable with composer and PHP 8, I 've found this.

Most of the Laminas components have a composer.json file. In this file the PHP version is written with the ^7.3 constraint. This means, that a PHP version >= 7.3 and < 8.0 is required. The ^7.3 constraint does not match PHP 8.0 although it 's higher than 7.3.

To allow anything higher than PHP 7.3 in the PHP 7 release cycle and PHP 8 the constraint should be “^7.3 || 8.0”.

Hopefully this will be fixed soon. I 've seen, that there is a pull request for PHP 8 support of laminas components. But I don 't know, if composer config is part of the pull request.

You can follow the progress on GitHub. There you can find a project for the support of PHP 8.0. laminas-mvc-skeleton is also included.

2 Likes