You are viewing documentation for an outdated version. It is no longer supported!

Version

The Version utility is able to determine if a version is available for a installed package and obtain it. Behind the scene, "pretty-package-versions"open in new window is being used.

package()

Returns the version of the given installed package.

An \OutOfBoundsException is thrown if the given package is not installed.

use Aedart\Utils\Version;

$version = Version::package('aedart/athenaeum-utils'); 

See "pretty-package-versions"open in new window for additional information.

hasFor()

Determine if a version is available for the given installed package.

If the package isn't installed, the method will simply return false.

$hasVersion = Version::hasFor('aedart/athenaeum-utils'); 

application()

Available since v5.7.0

The application() method returns the root level package's version (your application).

$version = Version::application(); 

Note

Unlike the package() and hasFor() methods, which rely on information from composer¹, this method relies on information from gitopen in new window to obtain correct version information.

¹: A custom Versions class is generated during composer install or update, containing package versions. This class is generated by the "pretty-package-versions"open in new window package.