Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastianbergmann/comparator
Provides the functionality to compare PHP values for equality.
https://github.com/sebastianbergmann/comparator
Last synced: 6 days ago
JSON representation
Provides the functionality to compare PHP values for equality.
- Host: GitHub
- URL: https://github.com/sebastianbergmann/comparator
- Owner: sebastianbergmann
- License: bsd-3-clause
- Created: 2013-11-05T00:36:12.000Z (about 11 years ago)
- Default Branch: main
- Last Pushed: 2024-10-18T15:01:16.000Z (3 months ago)
- Last Synced: 2024-10-29T21:59:06.278Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 59.7 MB
- Stars: 6,984
- Watchers: 9
- Forks: 68
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
- php-awesome - Comparator - 对比两个 PHP 变量值是否相等 (类库 / 未归类)
README
[![Latest Stable Version](https://poser.pugx.org/sebastian/comparator/v)](https://packagist.org/packages/sebastian/comparator)
[![CI Status](https://github.com/sebastianbergmann/comparator/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/comparator/actions)
[![codecov](https://codecov.io/gh/sebastianbergmann/comparator/branch/main/graph/badge.svg)](https://codecov.io/gh/sebastianbergmann/comparator)# sebastian/comparator
This component provides the functionality to compare PHP values for equality.
## Installation
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
```
composer require sebastian/comparator
```If 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:
```
composer require --dev sebastian/comparator
```## Usage
```php
getComparatorFor($date1, $date2);try {
$comparator->assertEquals($date1, $date2);
print "Dates match";
} catch (ComparisonFailure $failure) {
print "Dates don't match";
}
```