A small, independent wrapper to get pretty versions strings
MIT License
Bot releases are hidden (Show)
Version::NO_VERSION_TEXT
constant to retrieve the string used when no version is available (#41)Version::NO_VERSION_TEXT
constant when no version is available due to replaced package (#41)This small patch handles replaced and provided packages, so that consumers of this library can handle bad requests gracefully.
VersionMissingExceptionInterface
, and two exceptions implementing it: ProvidedPackageException
and ReplacedPackageException
ProvidedPackageException
when asking for the version of a package which is provided (was \TypeError
before)ReplacedPackageException
when asking for the version of a package which is replaced (was \TypeError
before)This release is aimed to become a bridge for native Composer 2 support. The BC breaks are minimal; if you're using it in a library, you're encouraged to require it with ^1.5 || ^2.0
, so that your end users will not be constrained to use a specific Composer version.
Version
methods added: getReference
, getShortReference
, getVersionWithShortReference
(see table below)Version
methods deprecated; this is a simple rename (commit
to reference
), to better reflect the meaning of Composer API data; the old methods are preserved but deprecated to reduce breaking changes:New method | Old, deprecated method |
---|---|
Version::getReference() |
Version::getCommitHash() |
Version::getShortReference() |
Version::getShortCommitHash() |
Version::getVersionWithShortReference() |
Version::getVersionWithShortCommit() |
PrettyVersions::SHORT_COMMIT_LENGTH
removedVersion::SHORT_COMMIT_LENGTH
made privateVersion
constructor changed arguments: second argument string $version
has been split into string $prettyVersion, string $reference
This release is intended to change the future release plan of this package. Please require the package with ^1.5 || ^2.0
to ensure full functionalities and future Composer 2 compatibility.
PrettyVersions::getRootPackageName
as a compatibility layer to be used in place of PackageVersions\Versions::ROOT_PACKAGE_NAME
, which would be a transient dependency (#23)PrettyVersions::getRootPackageVersion
, a shortcut to PrettyVersions::getVersion(PrettyVersions::getRootPackageName())
(#23)composer/package-versions-deprecated
as in 1.3 (see #21 & #22)ocramius/package-versions
to its fork composer/package-versions-deprecated
, to ensure compatibility with both PHP 7.* and Composer 2 (see #13, thanks @dereuromark and @seldaek)Version::__getShortCommitHash()
method (see #8, thanks @emodric)ocramius/package-versions
1.1.3 to avoid issues when removing the package (see this issue).gitattributes
file (#1)First release
Jean85\PrettyVersions
wraps the PackageVersions\Versions
class and returns a Jean85\Version
objectJean85\Version
has these methods available:
public function getPrettyVersion(): string
public function getFullVersion(): string
public function getVersionWithShortCommit(): string
public function getPackageName(): string
public function getShortVersion(): string
public function getCommitHash(): string