v1.0.1 2024-03-12 14:48 UTC

This package is auto-updated.

Last update: 2024-09-12 15:54:09 UTC


README

添加/删除/更新当前请求URI的查询字符串,接受Laravel的数组"点"表示法

安装

您可以通过composer安装此包

composer require vitnasinec/uri

用法

// https://domain.test/page?filter[foo]=bar&sort=-baz

uri()->addQuery('filter.other', 'next');
// https://domain.test/page?filter[foo]=bar&filter[other]=next&sort=-baz

uri('http://different.test/other?filter[other]=previous')->addQuery('filter.other', 'next');
// http://different.test/other?filter[other]=next

uri()->removeQuery('filter.foo')
// https://domain.test/page?sort=-baz

uri()->mergeQuery(['filter.foo' => 'changed', 'filter.other' => 'next']);
// https://domain.test/page?filter[foo]=changed&filter[other]=next&sort=-baz

uri()->mergeMissingQuery(['filter.foo' => 'skipped', 'filter.added' => true]);
// https://domain.test/page?filter[foo]=changed&filter[other]=next&sort=-baz

测试

composer test

变更日志

有关最近更改的更多信息,请参阅变更日志

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件