How do I make a script there can tell me what version i run when it stored in composer.json?
composer.json
{
"require": {
"someLiberyNameHere": "8.3.3.1"
}
}
I think that this is as simple as this since composer.json is a Json file:
<?php
$content = file_get_contents('/path/to/composer.json');
$content = json_decode($content,true);
var_dump($content['require']['someLiberyNameHere']);
You can also iterate through your dependencies:
foreach ($content['require'] as $key => $value) {
echo $key . ' => ' . $value . PHP_EOL;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With