https://github.com/takuya/php-timerange-overlap
check time range has overlapping .
https://github.com/takuya/php-timerange-overlap
Last synced: 3 months ago
JSON representation
check time range has overlapping .
- Host: GitHub
- URL: https://github.com/takuya/php-timerange-overlap
- Owner: takuya
- License: gpl-3.0
- Created: 2022-12-22T18:56:47.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2026-02-21T11:29:02.000Z (4 months ago)
- Last Synced: 2026-02-21T17:47:10.702Z (4 months ago)
- Language: PHP
- Size: 418 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TimeRange Overlapping Checker.

This library for checking Events/Schedule TimeRange have Overlapping.
## Check has overlapping.
## Usage
```php
use Takuya\PhpTimeOverlap\TimeRange;
$a = new TimeRange(new DateTime( '22:22' ),new DateTime( '23:22' ));
$b = new TimeRange(new DateTime( '22:44' ),new DateTime( '23:44' ));
## check time overlap
$a->has_overlapping($b); // => true
```
Other checking like this.
```php
$a->before($b);
$a->overlapped($b);
$a->during($b);
$a->overlaps($b);
$a->after($b);
$a->contains($b);
$a->same($b);
```
## Supported patterns.
I named overlapping patterns like this.

EQUALS(ex A.end==B.start ) patterns are excluded intentionally. If equal ex.`A->end == B->start` compared,It will be
overlapping. Comparing equals "22:22-**22:25**" to "**22:25**-22:27" , do minus explicitly ( `-1 sec` before comparing)
.
## Installation
from github
```shell
composer config repositories.'php-timerange-overlap' \
vcs https://github.com/takuya/php-timerange-overlap
composer require takuya/php-timerange-overlap:master
composer install
```
from packgist
```shell
composer require takuya/php-timerange-overlap
```
## Testing
```shell
git clone https://github.com/takuya/php-timerange-overlap
cd php-timerange-overlap
composer install
vendor/bin/phpunit
```