transprime-research / php-url
简化PHP中的URL处理
1.0.2
2023-08-23 21:07 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ~8.0
This package is auto-updated.
Last update: 2024-09-24 00:02:55 UTC
README
关于PHP-URL
这样工作
像专业人士一样做 🆗
安装
composer require transprime-research/php-url
快速使用
这样使用...
$url = new Url( fullDomain: 'https://:8080', path: '/api/hello', query: ['name' => 'John', 'public' => 'yes'], ); // Or $url = Url::make( scheme: 'http://', domain: 'localhost', port: '8080', path: '/api/hello', query: ['name' => 'John', 'public' => 'yes'], ); (string) $url; // https://:8080/api/hello?name=John&public=yes $url->toString(); // https://:8080/api/hello?name=John&public=yes
其他用法
$url = Url::make() ->setScheme('http://') ->setDomain('localhost') ->setPort('8080') ->setPath('/api/hello') ->addToQuery('name', 'John') ->addToQuery('public', 'yes'); (string) $url; // https://:8080/api/hello?name=John&public=yes
即将推出
API实现待定
附加信息
在此查看此系列中的其他软件包
- https://github.com/omitobi/conditional [一个智能PHP if...elseif...else语句]
- https://github.com/transprime-research/piper [一个面向对象的函数式PHP管道]
- https://github.com/transprime-research/arrayed [数组现在是一个对象]
- https://github.com/transprime-research/attempt [一个智能PHP try...catch语句]
- https://github.com/omitobi/corbonate [一个智能Carbon + Collection软件包]
- https://github.com/omitobi/laravel-habitue [带有集合响应的Jsonable Http Request(er)软件包]
类似软件包
- luzzardi/php-url
- martinmdev/php-url
- simlux/php-url
- thesmart/php-url
许可协议
MIT (见LICENCE文件)