This PHP 7 library readers the version number from the composer.json file.
This library is available through Packagist and can be installed using Composer:
composer require codeinc/composer-version-reader<?php
use CodeInc\ComposerVersionReader\ComposerVersionReader;
echo ComposerVersionReader::readVersion(__DIR__);
// outputs "1.0.0" or NULL if the "version" entry is not set.This library is published under the MIT license (see the LICENSE file).