
Wikis & learning
Check dependency requirements before running a project
Project metadata can distinguish the PHP runtime requirement from library dependencies. Read that metadata before installing a program on a shared host.
Project metadata can distinguish the PHP runtime requirement from library dependencies. Read that metadata before installing a program on a shared host.
Walkthrough
This small manifest is an original example of the structure Composer uses. Reading the declared constraint identifies what the project asks for. Composer performs actual constraint solving when installing the dependency set.
PHP example
<?php
$manifest = '{"require":{"php":"^8.0","ext-json":"*"}}';
$project = json_decode($manifest, true, 512, JSON_THROW_ON_ERROR);
echo 'PHP constraint: ', $project['require']['php'], PHP_EOL;
echo 'Requirements: ', implode(', ', array_keys($project['require']));Expected output
PHP constraint: ^8.0
Requirements: php, ext-jsonChange and check
Add an extension requirement and list the required keys again. For a real project, compare its installed platform requirements with the PHP binary that serves web requests.
Discussion
Sign in to participate.



