localtools / php-http-client
PHP的友好且强大的HTTP客户端包
v0.0.1
2023-12-18 04:01 UTC
Requires
- php: ^7.2.5 || ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- ext-curl: *
- bamarni/composer-bin-plugin: ^1.8.2
- pestphp/pest: ^1.23
- php-http/client-integration-tests: dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999
- php-http/message-factory: ^1.1
- phpunit/phpunit: ^8.5.36 || ^9.6.15
- psr/log: ^1.1 || ^2.0 || ^3.0
Suggests
- ext-curl: Required for CURL handler support
- ext-intl: Required for Internationalized Domain Name (IDN) support
- psr/log: Required for using the Log middleware
Provides
README
此包为PHP提供简单而强大的HTTP客户端,基于Guzzle构建。它简化了HTTP请求的创建过程,并允许轻松定制请求选项。
$client = new \PhpHttpClient\Client('https://api.example.com'); $response = $client->get('/endpoint'); echo $response->getStatusCode(); // 200
安装
安装PhpHttpClient推荐的方式是通过 Composer。
composer require localtools/php-http-client
特性
- 构建HTTP请求的流畅接口
- 支持多种身份验证方法(基本、摘要)
- 易于与PSR-7和PSR-18集成
- 基于Guzzle构建,利用其强大和灵活性