2017 © Pedro Peláez
 

library runscope

This package makes using Runscope in applications easy, including Guzzle and GuzzleHttp plugin

image

peterfox/runscope

This package makes using Runscope in applications easy, including Guzzle and GuzzleHttp plugin

  • Tuesday, July 15, 2014
  • by peterfox
  • Repository
  • 1 Watchers
  • 5 Stars
  • 1,287 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Runscope for PHP

  • Requires a free Runscope account, sign up here
  • Makes it easy to generate Runescope urls
  • Provides plugins for both Guzzle (3.0) and GuzzleHttp (4.0)
  • Has dependancy injection support for Laravel 4, through included ServiceProvider and Facade classes

Install by issuing:, (*1)

composer require peterfox/runscope

The most basic usage is as follows:, (*2)

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

use Runscope\Runscope;

$runscope = new Runscope('api-key-here');

$runscopeUrl = $runscope->proxify('https://api.github.com');

Please note, generating these urls will always provide a url that works on port 80/443 for http/https respectively as using ports other than the standard ones for a protocol requires headers., (*3)

Using with Guzzle/GuzzleHttp

applying the plugin is like so for Guzzle:, (*4)

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

use Runscope\Runscope;
use Guzzle\Http\Client;
use Runscope\Plugin\Guzzle\RunscopePlugin;

$runscope = new Runscope('api-key-here');

$client = new Client('https://api.github.com');

$runscopePlugin = new RunscopePlugin($runscope);

// Add the plugin
$client->addSubscriber($runscopePlugin);

// Send the request and get the response
$response = $client->get('/')->send();

Using the GuzzleHttp Plugin can be done with:, (*5)

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

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

$runscope = new Runscope('api-key-here');

$client = new Client('https://api.github.com');

$runscopePlugin = new RunscopePlugin($runscope);

// Attach the plugin
$client->getEmitter()->attach($runscopePlugin);

// Send the request and get the response
$response = $client->get('/');

Laravel 4 Integration

Add the service provider:, (*6)

'providers' => array(
    ...
    'Runscope\RunscopeServiceProvider'
)

You can then publish the config file from the package:, (*7)

php artisan config:publish peterfox/runscope

The blank config will at a minimum require your bucket key (ID):, (*8)

<?php

return array(
    'bucket_key' => '',
    'auth_token' => null,
    'gateway_host' => 'runscope.net'
);

With the service provider in place it will also set up the Facade for you so you can use:, (*9)

$url = Runscope::proxify('https://api.github.com');

You'll also have a helper function which makes things a little lighter, (*10)

$url = runscope_url('https://api.github.com');

The Versions

15/07 2014

dev-master

9999999-dev https://github.com/peterfox/laravel-runscope

This package makes using Runscope in applications easy, including Guzzle and GuzzleHttp plugin

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel guzzle runscope

18/05 2014

1.0.1

1.0.1.0 https://github.com/peterfox/laravel-runscope

This package makes using Runscope in applications easy, including Guzzle and GuzzleHttp plugin

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel guzzle runscope

16/05 2014

1.0.0

1.0.0.0 https://github.com/peterfox/laravel-runscope

This package makes using Runscope in applications easy, including Guzzle and GuzzleHttp plugin

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel guzzle runscope