Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 21, 2024 via composer

phar-io/version 3.2.1

Library for handling version information and constraints
Package summary
Share
0
issues
1
license
1
BSD-3-Clause
Package created
30 Nov 2016
Version published
21 Feb 2022
Maintainers
2
Total deps
1
Direct deps
0
License
BSD-3-Clause

Issues

0
This package has no issues

Licenses

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
phar-io/version@3.2.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of phar-io/version 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does phar-io/version do?

The "phar-io/version" is a useful PHP library that allows users to handle version information and constraints within their applications. It gives developers the ability to describe both a range of versions or a single, discrete version number, following the widely-accepted Semantic Versioning schema. It also supports typical mathematic operators for easy range descriptions and two special operators, caret (^) and tilde (~), for additional versioning flexibility. In addition to version handling and constraint management, pre-release label support is featured, enhancing version comparisons further.

How do you use phar-io/version?

Utilizing "phar-io/version" within your PHP projects involves integrating it with your project using Composer, and subsequently executing commands in your PHP code depending on your needs. For instance, to add the "phar-io/version" as a local, per-project dependency, one would typically run the composer require phar-io/version in their project directory.

Once installed, you can use it as shown in the examples below:

use PharIo\Version\Version;
use PharIo\Version\VersionConstraintParser;

$parser = new VersionConstraintParser();
$caret_constraint = $parser->parse( '^7.0' );
$tilde_constraint = $parser->parse( '~1.1.0' );

Here, a new instance of the VersionConstraintParser is being created and used to parse various version strings. To verify whether certain versions comply with these parsed constraints, you could code:

$caret_constraint->complies( new Version( '7.0.17' ) ); // returns true
$tilde_constraint->complies( new Version( '1.1.4' ) ); // returns true

Furthermore, version comparisons, considering pre-release labels, can be achieved as in the following snippet:

$leftVersion = new PharIo\Version\Version('3.0.0-alpha.1');
$rightVersion = new PharIo\Version\Version('3.0.0-alpha.2');

$leftVersion->isGreaterThan($rightVersion); // returns false
$rightVersion->isGreaterThan($leftVersion); // returns true

These examples show ways in which you can integrate the use of "phar-io/version" into your projects to manage and manipulate version information effectively.

Where are the phar-io/version docs?

The documentation for the "phar-io/version" can be found directly within its GitHub repository. The GitHub README file for the repository includes detailed instructions on installation and usage, along with code examples that comprehensively demonstrate functionality. This resource serves as a comprehensive guide for understanding and leveraging the powerful features provided by "phar-io/version" in your PHP projects.