belamov/postgres-range
Laravel package for working with PostgreSQL range types. Cast Eloquent attributes into range objects (int4range, numrange, tsrange, daterange) and use query helpers for contains, overlaps, and other range operations, all without writing raw SQL.
Architecture fit: belamov/postgres-range is a Laravel/PostgreSQL adapter package for working with PostgreSQL range types through Eloquent. It fits applications already committed to PostgreSQL where domain data naturally uses ranges: availability windows, booking periods, price validity, version effective dates, numeric intervals, and temporal containment queries. It is not a fit for database-agnostic products, MySQL/SQLite-first stacks, or teams without PostgreSQL range-type experience.
Integration feasibility: Integration is likely low-effort: Composer install, Laravel auto-discovery/service provider, and Eloquent casts for range columns. Release 1.3.1 is a patch release that adds Laravel 13.x compatibility and updates test/tooling dependencies. No new product capability, breaking change, or deprecation is called out. The main feasibility check is whether the package’s Composer constraints and PHP requirements align with the target application.
Technical risk: Functional risk from 1.3.1 appears low based on the release notes. The meaningful risks are dependency-related and domain-related: Laravel 13 compatibility may change transitive constraints; PHPUnit 12 is dev-only but may signal a raised PHP floor in package development; PostgreSQL range semantics can be subtle around empty vs. unbounded ranges, inclusive/exclusive bounds, null handling, and timezone behavior for tstzrange. Query performance depends on correct indexing and query patterns, not just casting support.
Key questions:
btree_gist?Stack fit: Use this package only in Laravel services backed by PostgreSQL that already need native range columns. Add it as a normal Composer dependency, preferably pinned to ^1.3.1 or the narrowest acceptable constraint. It should be treated as a focused persistence-layer utility, not a platform dependency.
Migration path: Treat 1.3.1 as a low-risk patch update. Create a branch, update the package and lockfile, inspect dependency changes, and run the full test suite against PostgreSQL. Because release notes do not indicate schema changes, application migrations are unlikely, but any published package config or package-specific migration should be checked. If the application is not yet using the package, start with one bounded range use case rather than broad adoption.
Compatibility: The headline compatibility item is Laravel 13.x support. Confirm whether the package still supports the application’s current Laravel and PHP versions before using 1.3.1 as part of a Laravel upgrade. The PHPUnit 12 shift is primarily package-development tooling, but it should prompt a check of the package’s PHP requirement and CI matrix. Validate compatibility in a staging environment with the same PostgreSQL major version as production.
Sequencing:
tstzrange timezone behavior.Maintenance: Ongoing maintenance is likely low. This is a small, focused dependency, and 1.3.1 is maintenance-oriented. Pin the version, monitor upstream releases, and review Laravel/PHP compatibility updates during framework upgrades. Assign an internal owner for PostgreSQL range semantics and query performance.
Support: Support is community/open-source rather than vendor-backed. The team should have an internal escalation path for package defects and a process for evaluating upstream issues. Avoid making the package a critical unowned dependency in high-value scheduling, billing, or entitlement domains.
Scaling: PostgreSQL range types can scale well when indexed correctly. Overlap and containment queries typically need appropriate GiST indexes; equality and sort patterns may need B-tree indexes. Eloquent casting overhead is usually modest per row, but range-heavy reporting should be validated with real query plans. Avoid N+1 access patterns and test large-table behavior before broad rollout.
Failure modes: Likely failure modes include Composer constraint conflicts during Laravel upgrades, incorrect handling of empty or infinite bounds, timezone drift in tstzrange, slow range queries from missing indexes, and exclusion constraints requiring btree_gist. Rollback should be straightforward by pinning the prior package version, but any data written through changed casting behavior should be validated before rollback.
Ramp-up: Laravel developers should ramp up quickly on installation and Eloquent casts. Ramp-up is moderate for PostgreSQL range semantics, indexing strategy, and boundary testing. Provide internal examples for common range columns, query helpers, and edge-case tests before encouraging broad use.
How can I help you explore Laravel packages today?