flex-url
v3.1.0
Published
Zero-dependency URL builder/parser for the apiable request grammar
Readme
flex-url
An immutable, fluent URL builder/parser for the Laravel Apiable request-query grammar. Zero runtime dependencies, ESM + CJS, full type declarations.
Installation
npm install flex-urlUsage
import {url} from 'flex-url';
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
PHP mirror
A PHP port with identical method names/semantics lives alongside this package at
packages/php (open-southeners/flex-url on Packagist) for server-driven tables (e.g.
Livewire). 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.
