Download the PHP package valorin/debver without Composer
On this page you can find all versions of the php package valorin/debver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download valorin/debver
More information about valorin/debver
Files in valorin/debver
Package debver
Short Description Simple PHP helper class for comparing Debian/Ubuntu package version strings.
License BSD-3-Clause
Homepage https://github.com/valorin/debver
Informations about the package debver
debver - Debian/Ubuntu packager version helper
Simple PHP helper class for working with Debian/Ubuntu package version strings.
Installing
The easiest way to install Debver is to use Composer, the awesome dependency manager for PHP. Once Composer is installed, run composer.phar require valorin/debver:1.*
and composer will do all the hard work for you.
Usage
If you are using the autoloader in Composer (or your framework ties into it), then all you need to do is add a use Debver\Version;
statement at the top of each file you wish to use Debver in and us e it like a normal class:
Compare two version strings:
Extract version string components:
The three components to a version string can be extracted easily: Epoch, Upstream Version, and Debian Revision:
Compare two version strings using dpkg:
If you are running on a Ubuntu/Debian box, you can use dpkg
directly to compare two packages (100% accuracy for all of the really wacky version strings).
This option was added for testing the custom functions, and I decided to leave it in just in case.
Internally it uses dpkg --compare-versions {$version1} lt {$version2}
via a system()
call.
Retrieve a "compare string" for storing in a database
Occasionally you need to store a large amount of version numbers in a database and then compare them in bulk using the database itself, rather than extracting the data and manipulating it in code. A "compare string" is a verbose version of the version string that can be compared using basic string comparison functions (>
<
==
), making it perfect for use in a database..