castor / uri
RFC 3986 兼容的 URI 值对象
0.3.0
2022-10-12 23:59 UTC
Requires
- php: >=8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.11
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.27
README
RFC 3986 兼容的 URI 值对象。
安装
您可以使用以下命令安装最新稳定版本
composer require castor/uri
快速入门
<?php use Castor\Net\Uri; $uri = Uri::parse('https://example.com/hello?foo=bar'); echo $uri->getScheme(); // Prints: https echo $uri->getHost(); // Prints: example.com echo $uri->getPath(); // Prints: /hello echo $uri->getRawQuery(); // Prints: foo=bar echo $uri->getQuery()->add('foo', 'foo')->encode(); // Prints: foo=bar&foo=foo
要了解该库背后的理念、使用时的最佳实践以及实现示例,请查看文档。