Git Product home page Git Product logo

guzzle-hook's Introduction

Guzzle Hook

让 Guzzle 支持 Swoole 的 PHP Stream Hook 协程

安装

支持的 Guzzle 版本:

  • guzzle-6.0 (>= 6.0.2)
  • guzzle-6.1
  • guzzle-6.2
  • guzzle-6.3

使用 Composer 安装:

composer require mix/guzzle-hook

在项目的 composer.json 文件中增加 extra 配置项,如下:

"extra": {
    "include_files": [
      "vendor/mix/guzzle-hook/src/functions_include.php"
    ]
}

更新自动加载:

composer dump-autoload

原理

因为 Swoole 的 Hook 只支持 PHP Stream,Guzzle 库默认是使用 CURL 扩展,导致无法 Hook 为协程,本库修改了 Guzzle 的默认 Handler 为 StreamHandler,让依赖 Guzzle 的第三方库无需修改代码即可使用 Swoole 协程。

支持的第三方库

理论上基于 Guzzle 库开发的 SDK 都可使用本库 Hook,下面是已知的支持 Hook 的第三方库清单:

欢迎提交 PR 更新此清单

License

Apache License Version 2.0, http://www.apache.org/licenses/

guzzle-hook's People

Contributors

hfleon avatar onanying avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.