Download the PHP package gosuperscript/schema-interval without Composer
On this page you can find all versions of the php package gosuperscript/schema-interval. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gosuperscript/schema-interval
More information about gosuperscript/schema-interval
Files in gosuperscript/schema-interval
Package schema-interval
Short Description A PHP library that extends gosuperscript/axiom with support for Interval types, providing type-safe interval handling and operator overloading for schema validation
License MIT
Informations about the package schema-interval
Axiom Interval
A PHP library that extends gosuperscript/axiom with support for Interval types: a Type that validates and coerces intervals, and an Extension that teaches the compiler to compare them.
Features
- Interval Type: Validate and coerce interval values at a program's boundary
- Operator rules: Compare an interval against a number (
>,<,>=,<=) and two intervals for equality (==,!=), resolved and type-checked at compile time - Type Safety: Built with PHP 8.4+ strict types
- Format Support: Parse intervals from string notation (e.g.,
[1,2],(1,2))
Requirements
- PHP ^8.4
- ext-intl
- gosuperscript/axiom
- superscript/interval ^1.0.4
Installation
Install via Composer:
Usage
The interval type
IntervalType is an Axiom Type: it coerces and asserts interval values, formats them, and projects into the shape algebra as an opaque interval identity.
Interval notation
[1,2]— Closed interval (includes both endpoints)(1,2)— Open interval (excludes both endpoints)[1,2)— Half-open (includes left, excludes right)(1,2]— Half-open (excludes left, includes right)
The extension
IntervalExtension contributes the interval's operator rules and its literal registration. Compose it onto the core dialect and hand the dialect to an expression; the compiler resolves and type-checks every operator against it, and the compiled Program runs what it resolved — no runtime dispatch.
Supported operations
- Ordering against a number —
interval > number,>=,<,<=→ boolean. The interval is the left operand. - Equality against another interval —
interval == interval,!=(and the=/===/!==aliases) → boolean. Core refuses equality on opaque operands, so the interval package owns its own.
Operand types that no rule accepts — interval == number, interval + interval — are refused at compile time with a named diagnostic, never at runtime.
Development
Testing
Run the full test suite:
Or run individual suites:
Code Style
This project uses Laravel Pint for code formatting:
License
This project is licensed under the MIT License - see the LICENSE file for details.
Credits
- Built on superscript/interval
- Extends gosuperscript/axiom
All versions of schema-interval with dependencies
ext-intl Version *
gosuperscript/axiom Version ^0.6.9
superscript/interval Version ^2.0