A new feature in Composer v2 allows you to selectively ignore platform requirements.

composer install --ignore-platform-req=php

Compared to --ignore-platform-reqs

Composer already has a --ignore-platform-reqs option (notice the s in reqs), but it ignores all platform requirements, including PHP version, extensions (ext-*), and composer-plugin-api.

The new --ignore-platform-req option can be used to set specific requirements that Composer can ignore.

Ignore multiple platform requirements

You can specify one or more platform requirements to ignore by simply using the option multiple times.

For example, to ignore the PHP version and ext-zip, but enforce all other platform requirements, you can use the command like this:

composer install --ignore-platform-req=php --ignore-platform-req=ext-zip

Install Composer packages on unreleased PHP versions

A common use-case of ignore-platform-req option would be to test PHP packages in unreleased PHP versions, or dev builds of PHP.

Libraries such as PHPUnit come with rather strict PHP version constraint in their composer.json file, which prevents them the libraries from being installed in dev versions of PHP.

Instead of using ignore-platform-reqs, which would ignore all platform requirements such as extensions (which might be required for the package to function), you can use ignore-platform-req option to selectively specify platform requirements you intentionally ignore.

Recent Articles on PHP.Watch

All ArticlesFeed 
PHP 8.2 Highlights: What's New and Changed

PHP 8.2 Highlights: What's New and Changed

Read about the highlights of PHP 8.2: Major new features, changes, and deprecated functionality.
How to install/upgrade PHP 8.2 on Debian and Ubuntu systems

How to install/upgrade PHP 8.2 on Debian and Ubuntu systems

A detailed and a quick-start guide on installing and upgrading PHP 8.2 on Debian and Ubuntu systems
All the Easter Eggs in PHP

All the Easter Eggs in PHP

A trip down the memory with PHP's Easter Eggs over the years
Subscribe to PHP.Watch newsletter for monthly updates

You will receive an email on last Wednesday of every month and on major PHP releases with new articles related to PHP, upcoming changes, new features and what's changing in the language. No marketing emails, no selling of your contacts, no click-tracking, and one-click instant unsubscribe from any email you receive.