承接 hannesvdvreken/guzzle-clockwork 相关项目开发

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

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

hannesvdvreken/guzzle-clockwork

最新稳定版本:4.0.0-RC1

Composer 安装命令:

composer require hannesvdvreken/guzzle-clockwork

包简介

A Guzzle middleware that logs requests with Clockwork

README 文档

README

⚠️ This project is up for adoption. Get in touch if you're interested in actively maintaining 3 closely related packages.

Build Status Latest Stable Version Code Quality Code Coverage Total Downloads License

Guzzle middleware for logging requests clockwork's timeline so you can view the timeline in your browser's developer tools.

Developer tools timeline

Developer tools logs

Usage

// First you need a Clockwork object
$clockwork = \Clockwork\Support\Vanilla\Clockwork::init();

// Create the Guzzle middleware
$middleware = new \GuzzleHttp\Profiling\Middleware(
    new \GuzzleHttp\Profiling\Clockwork\Profiler($clockwork->getClockwork()->timeline())
);

// Then you need to add it to the Guzzle HandlerStack
$stack = \GuzzleHttp\HandlerStack::create();

$stack->unshift($middleware);

$client = new \GuzzleHttp\Client(['handler' => $stack]);

$client->get('https://httpbin.org/status/418');

Depending on your integration of Clockwork, make sure that you call $clockwork->requestProcessed(); before you output your page.

Laravel

If you are using Laravel, use the included service providers to add the subscriber to every Guzzle Client.

'providers' => [
    ...
    \Clockwork\Support\Laravel\ClockworkServiceProvider::class,
    \GuzzleHttp\Profiling\Clockwork\Support\Laravel\ServiceProvider::class,
],

Be sure to create every client (type hint with GuzzleHttp\ClientInterface or GuzzleHttp\Client) via the IoC container.

Guzzle v4 and v5

Versions 0.2.0 and up until 1.0.0 (exclusively) are all compatible with Guzzle v4 and v5. To develop for these versions of Guzzle, use the guzzle4-5 branch.

Use

Guzzle v3

If you want to continue to work with the old Guzzle v3 (Guzzle\Http\Client instead of GuzzleHttp\Client) ClockworkPlugin then you might want to install the 0.1.* releases. Pull request with Guzzle v3 compatibility should be made against the guzzle3 branch. Install the latest guzzle v3 compatible version with 0.1.* or dev-guzzle3.

Contributing

Feel free to make a pull request. Please try to be as PSR-2 compliant as possible. Fix Code Style quickly by running vendor/bin/php-cs-fixer fix. Give a good description of what is supposed to be added/changed/removed/fixed.

Testing

To test your code before pushing, run the unit test suite.

vendor/bin/phpunit

License

MIT

统计信息

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

GitHub 信息

  • Stars: 44
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-01-20