Download the PHP package gpslab/interval without Composer
On this page you can find all versions of the php package gpslab/interval. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gpslab/interval
More information about gpslab/interval
Files in gpslab/interval
Package interval
Short Description DDD interval structures
License MIT
Homepage https://github.com/gpslab/interval
Informations about the package interval
Interval Value Objects
This is a library with a set of classes intended to describe intervals as Value Objects and perform operations on them.
Installation
Pretty simple with Composer, run:
Interval type
This library is supports interval types.
[a, b] = [a, b] = {x ∈ ℝ | a ≤ x ≤ b}
- Closed[a, b) = [a, b[ = {x ∈ ℝ | a ≤ x < b}
- Half-closed(a, b] = ]a, b] = {x ∈ ℝ | a < x ≤ b}
- Half-open(a, b) = ]a, b[ = {x ∈ ℝ | a < x < b}
- Open
Intervals
- Number
- Date
- Time
- DateTime
- Week
- Month
- Year
- IPv4
- IPv6
- IPv4Network
- IPv6Network
Usage intervals
Create interval [1, 5)
Change intervals
IPv4 network
Local network
Interval operations
equal
- Checks if this Interval is equal to the specified interval;contains
- Does this interval contain the specified point;intersects
- Does this interval intersect the specified interval;intersection
- Gets the intersection between this interval and another interval;cover
- Gets the covered interval between this Interval and another interval;gap
- Gets the gap between this interval and another interval;abuts
- Does this interval abut with the interval specified;join
- Joins the interval between the adjacent;union
- Gets the union between this interval and another interval;before
- The point is before the interval;after
- The point is after the interval.
Iterate intervals
The following intervals support iteration:
- Number
- Date
- Time
- DateTime
- Week
- Month
- Year
- IPv4
- IPv4Network
Example usage
Use step 1
and closed interval type [1, 5]
Use step 2
and open interval type (0, 10)
Iterate IPv4 interval
Iterate date interval
Persistence in Doctrine
You cat use intervals as Custom Mapping Types for Doctrine.
You cat registration custom Doctrine mapping types in Symfony
License
This bundle is under the MIT license. See the complete license in the file: LICENSE