Download the PHP package ciloe/ranges without Composer
On this page you can find all versions of the php package ciloe/ranges. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package ranges
Short Description A ranges representation library for PHP
License GPL-3.0-or-later
Informations about the package ranges
Ranges
This library provides classes for working with ranges of values.
Installation
Available Range Types
IntRange
The IntRange class allows you to represent and manipulate integer ranges. It offers a complete API for creating, comparing, and transforming ranges of integer numbers.
For detailed documentation on the IntRange class, see IntRange Documentation.
BigIntRange
The BigIntRange class allows you to represent and manipulate arbitrary precision integer ranges. It offers the same API as IntRange but works with string representations of integers, allowing for values beyond PHP's native integer limits (PHP_INT_MAX).
This class uses the BCMath extension for all operations, ensuring accurate calculations with very large integers.
For detailed documentation on the BigIntRange class, see BigIntRange Documentation.
DateRange
The DateRange class allows you to represent and manipulate date ranges. It offers a complete API for creating, comparing, and transforming ranges of dates using DateTimeImmutable objects.
This class supports custom step intervals (days, weeks, months, etc.) for generating date series and provides operations for date range manipulation.
For detailed documentation on the DateRange class, see DateRange Documentation.
Quick Examples
IntRange Example
BigIntRange Example
DateRange Example
Exceptions
InvalidArgumentException: Invalid range formatInvalidBoundException: Invalid bounds (lower > upper)InvalidInfiniteBoundException: Infinite bound with inclusionInvalidStepToGenerateSeriesException: Invalid step for generating a seriesCantGenerateSeriesBecauseTheArrayIsTooLarge: Series too large to be generated
Notes
- Ranges can have infinite bounds (null)
- Bounds can be inclusive (
[,]) or exclusive ((,)) - The step only affects series generation, not other operations
- Operations between ranges (union, intersection) require the same step