Version utilities

Learn how to create a new Inphinit project.

Parse version

use Inphinit\Utility\Version; $version = new Version('1.0.0'); print_r($version); var_dump($version);

Edit version variable

use Inphinit\Utility\Version; $input = '1.0.0'; $version = new Version($input); $version->major = '2'; $version->minor = '4'; $version->patch = '6'; $version->prerelease = ['a', 'b', 'c']; $version->build = ['1', '2', '3']; $output = "{$output}"; // to string echo "Before: {$input}, after: {$output}";

Check if version string is valid

use Inphinit\Utility\Version; $input = '1.0.0'; if (Version::valid($input)) { echo 'Valid version'; } else { echo 'Invalid version'; }
Go to homepage
Star us on Github