vitnasinec / uri
v1.0.1
2024-03-12 14:48 UTC
Requires
- php: ^7.2|^8.0
- illuminate/http: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/routing: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- ext-json: *
- larastan/larastan: ^2.0
- orchestra/testbench: ^4.0|^5.0|^6.0|^7.0|^8.0
- phpunit/phpunit: ^8.0|^9.0|^10.0
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)。有关更多信息,请参阅许可证文件