Download the PHP package icecave/parity without Composer

On this page you can find all versions of the php package icecave/parity. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package parity

Parity

Build Status Code Coverage Latest Version

Parity is a deep comparison library for PHP.

composer require icecave/parity

Rationale

PHP does not provide a way to reliably and strictly compare values of heterogeneous types. Most of the built-in comparison operators perform often undesired type-juggling. The one exception is the strict equality operator, which has the further caveat that it can only compare objects by their identity. No type-strict mechanism is provided for comparing objects by their properties; nor are there any type-strict versions of the relative comparison operators (less-than, greater-than, etc).

Parity aims to fill the void by providing a comparison engine with the following features:

Example

The Parity comparison engine is accessed via static methods on the Parity facade class. These methods accept any types and are guaranteed to produce a deterministic comparison result1. Some basic examples are shown below using integers.

Concepts

Comparable

The core concept of Parity is the comparable. A comparable is any object that provides its own behavior for comparison with other values. The following refinements of the comparable concept are supported by the comparison engine:

Comparator

A Comparator defines comparison behavior for values other than itself. Parity provides the following comparator implementations:

Algorithm Resolution

The following process is used by Parity::compare($A, $B) to determine which comparison algorithm to use:

Use $A->compare($B) if:

  1. $A is Any Comparable; or
  2. $A is Restricted Comparable and $A->canCompare($B) returns true; or
  3. $A is Self Comparable and $A is exactly the same type as $B; or
  4. $A is Sub Class Comparable and $B is an instance of the class where $A->compare() is implemented

If none of the conditions above are true, the comparison is tried in reverse with $A on the right hand side and $B on the left; the result is also inverted. If still no comparison is possible, Parity falls back to a strictly-typed deep comparison.

When comparing scalar types, integers and doubles (PHP's only true numeric types) are treated as though they were the same type, such that the expression 3 < 3.5 < 4 holds true. Numeric strings are not compared in this way.

Caveats

  1. Comparison of recursive objects is not a truly deterministic operation as objects are compared by their object hash where deeper comparison would otherwise result in infinite recursion.

All versions of parity with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
icecave/repr Version ^4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package icecave/parity contains the following files

Loading the files please wait ....