承接 mekras/psr7-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mekras/psr7-client

Composer 安装命令:

composer require mekras/psr7-client

包简介

PSR-7 compatible HTTP client library

README 文档

README

PSR-7 compatible HTTP client library.

Latest Stable Version License Build Status Coverage Status

Simple cURL based PSR-7 compatible HTTP client library.

Attention!

This package will be replaced with php-http/curl-client.

Migrating to Httplug

  1. Add php-http/httplug to your project requirements.
  2. Replace Mekras\Http\Client\CurlHttpClient and Mekras\Interfaces\Http\Client\HttpClientInterface with Http\Client\HttpClient in argument type hints
  3. Replace send() method calls with sendRequest.

Mekras\Http\Client\CurlHttpClient supports both Mekras\Interfaces\Http\Client\HttpClientInterface and Http\Client\HttpClient interfaces, so migration can be done gradually.

After dropping last Mekras\Interfaces\Http\Client\HttpClientInterface usage:

  1. Add any of php-http/client-implementation to your project and configure it.
  2. Replace instances of Mekras\Http\Client\CurlHttpClient with instances of chosen php-http/client-implementation.
  3. Remove mekras/psr7-client requirement from your composer.json.

Supported libraries

Usage

use GuzzleHttp\Psr7\Request;
use Mekras\Http\Client\Connector\GuzzleConnector;
use Mekras\Http\Client\CurlHttpClient;

$client = new CurlHttpClient(new GuzzleConnector());
$request = new Request('GET', 'http://example.org/');
$response = $client->send($request);
echo $response->getBody()->getContents());

Options

Options can be set via second argument in constructor. Available options are:

  • connection_timeout (int) — connection timeout in seconds;
  • curl_options (array) — custom cURL options;
  • decode_content (bool) — see CURLOPT_ENCODING;
  • follow_redirects (bool) — automatically follow HTTP redirects;
  • max_redirects (int) — maximum nested redirects to follow;
  • ssl_verify_peer (bool) — verify peer when using SSL
  • timeout (int) — overall timeout in seconds.
  • use_cookies (bool) — save and send cookies;
use Mekras\Http\Client\Connector\GuzzleConnector;
use Mekras\Http\Client\CurlHttpClient;

$client = new CurlHttpClient(
    new GuzzleConnector(),
    [
        'timeout' => 60,
        'curl_options' => [
            CURLOPT_CAPATH => '/path/to/ca'
        ]
    ]
);

统计信息

  • 总下载量: 2.2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: 未知许可证
  • 更新时间: 2015-04-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固