open-southeners / flex-url
Zero-dependency URL builder/parser for the apiable request grammar (PHP mirror)
v3.1.0
2026-09-10 23:09 UTC
Requires
- php: ^8.2
Requires (Dev)
- laravel/pint: ^1.22
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
An immutable, fluent URL builder/parser for the Laravel Apiable request-query grammar. Zero runtime dependencies, framework-free.
Installation
composer require open-southeners/flex-url
Usage
use function flex_url; flex_url('https://api.example.com/posts') ->filter('status', 'published') ->sort('-created_at') ->include('tags', 'author') ->page(1) ->toString(); // => "https://api.example.com/posts?filter[status]=published&sort=-created_at&include=tags,author&page[number]=1"
Documentation
TypeScript mirror
A TypeScript core with identical method names/semantics lives alongside this package at
packages/js (flex-url on npm). Both implementations are tested against the same
shared JSON fixtures so they can't silently drift apart.
License
This package is open-sourced software licensed under the MIT license.
