定制 softonic/guzzle-proxy-middleware 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

softonic/guzzle-proxy-middleware

最新稳定版本:0.0.4

Composer 安装命令:

composer require softonic/guzzle-proxy-middleware

包简介

This package allows you to use a proxy transparently in guzzle.

README 文档

README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads Average time to resolve an issue Percentage of issues still open

This package provides middleware for guzzle for handling proxy connection using one of the following proxy services:

Installation

To install, use composer:

composer require softonic/guzzle-proxy-middleware

Usage

To use this middleware, you need to initialize it like:

For Proxy Bonanza:

$proxyManager = new ProxyManager(
    new ProxyBonanza(
        new GuzzleClient(),
        $cache, // A PSR-6 item pool cache.
        '<YOUR-USER-PACKAGE-ID>',
        '<YOUR-API-KEY>'
    )
);

For SSL Private Proxy:

$proxyManager = new ProxyManager(
    new SslPrivateProxy(
        new GuzzleClient(),
        $cache, // A PSR-6 item pool cache.
        '<YOUR-API-KEY>'
    )
);

And inject it to Guzzle with something like:

$stack = new HandlerStack();
$stack->setHandler(new CurlHandler());
$stack->push($proxyManager);
$guzzleClient = new GuzzleClient(['handler' => $stack]);

From now on every request sent with $guzzleClient will be done using a random proxy from your proxy list.

Testing

softonic/guzzle-proxy-middleware has a PHPUnit test suite and a coding style compliance test suite using PHP CS Fixer.

To run the tests, run the following command from the project folder.

$ docker-compose run test

To run interactively using PsySH:

$ docker-compose run psysh

License

The Apache 2.0 license. Please see LICENSE for more information.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 7
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2019-01-16