1[![Build Status](https://travis-ci.org/sebastianbergmann/comparator.svg?branch=master)](https://travis-ci.org/sebastianbergmann/comparator)
2
3# Comparator
4
5This component provides the functionality to compare PHP values for equality.
6
7## Installation
8
9You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
10
11    composer require sebastian/comparator
12
13If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
14
15    composer require --dev sebastian/comparator
16
17## Usage
18
19```php
20<?php
21use SebastianBergmann\Comparator\Factory;
22use SebastianBergmann\Comparator\ComparisonFailure;
23
24$date1 = new DateTime('2013-03-29 04:13:35', new DateTimeZone('America/New_York'));
25$date2 = new DateTime('2013-03-29 03:13:35', new DateTimeZone('America/Chicago'));
26
27$factory = new Factory;
28$comparator = $factory->getComparatorFor($date1, $date2);
29
30try {
31    $comparator->assertEquals($date1, $date2);
32    print "Dates match";
33}
34
35catch (ComparisonFailure $failure) {
36    print "Dates don't match";
37}
38```
39
40