shahariaazam / http-client-support
一个灵活、可扩展、可定制的PSR-18兼容HTTP客户端构建器,适用于PHP。您可以将它添加到您的库中,并使用它提供用户使用自定义PSR-18兼容HTTP客户端的灵活性。
v1.0
2020-06-01 12:58 UTC
Requires
- php: >=7.0
- nyholm/psr7: ^0.2.3
- psr/http-client: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpcompatibility/php-compatibility: ^9.3
- phpunit/phpunit: ^6.5
- squizlabs/php_codesniffer: ^3.5
Suggests
- php-http/curl-client: cURL client for PHP-HTTP
- symfony/http-client: HTTP client provided by Symfony team
This package is auto-updated.
Last update: 2024-08-29 05:36:59 UTC
README
HTTP客户端构建器
一个灵活、可扩展、可定制的PSR-18兼容HTTP客户端构建器,适用于PHP。您可以将它添加到您的库中,并使用它提供用户使用自定义PSR-18兼容HTTP客户端的灵活性。
用法
只需将此库添加到您的composer.json
文件中。
composer require shahariaazam/http-client-support
现在,如果您在现有类中需要任何HTTP请求,只需扩展您的类以包含ShahariaAzam\HTTPClientSupport\HTTPSupport
。
以下是一个示例。
<?php namespace ShahariaAzam\HTTPClientSupport; class YourClass extends HTTPSupport { // Now your class have the following method already // public function setHttpClient(ClientInterface $httpClient) // public function getHttpClient() // public function getHttpHeaders() // public function setHttpHeaders() // public function getHttpHeaders() // Now perform HTTP request with the following method // public function httpRequest($method, $uri, $headers = [], $body = null, $version = '1.1') }
贡献者
您可以从这里查看完整的贡献者列表。您也欢迎为此存储库做出贡献。
问题
在此提交您的问题