mikey27cubes/runscope-guzzle-plugin

此软件包为 Guzzle 5.x PHP 库添加了 Runscope 支持。

0.1.0 2015-03-02 22:05 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:24:12 UTC


README

Runscope 的 Guzzle 5.x 插件

  • 需要免费 Runscope 账户,在此注册
  • 自动为您的请求创建 Runscope URL
  • 使用端口时,自动创建正确的 Runscope-Request-Port 头部
  • 支持受认证的桶和服务区域(见以下示例)

通过以下命令安装

    ~ composer require mike27cubes/runscope-guzzle-plugin

用法如下

<?php
require __DIR__ . '/../vendor/autoload.php';

use GuzzleHttp\Client;
use Runscope\Plugin\RunscopePlugin;

$client = new Client();

$runscopePlugin = new RunscopePlugin('bucket_key');

// authenticated bucket
// $runscopePlugin = new RunscopePlugin('bucket_key', 'authTokenHere');

// service region
// $runscopePlugin = new RunscopePlugin('bucket_key', null, 'eu1.runscope.net');

$client->getEmitter()->attach($runscopePlugin);

// Send the request and get the response
$response = $client->get('https://api.github.com/');

享受吧!