• This repository has been archived on 07/Oct/2021
  • Stars
    star
    5
  • Rank 2,861,937 (Top 57 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A PHP library for making it easy to use Runscope with your web hooks and external API calls

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:

composer require peterfox/runscope

The most basic usage is as follows:

<?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.

Using with Guzzle/GuzzleHttp

applying the plugin is like so for Guzzle:

<?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:

<?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:

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

You can then publish the config file from the package:

php artisan config:publish peterfox/runscope

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

<?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:

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

You'll also have a helper function which makes things a little lighter

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

More Repositories

1

laravel-webhook-demo

The example code for the article https://medium.com/@SlyFireFox/laravel-innovations-making-your-own-webhook-mechanism-through-notifications-96e75e99a2b1
PHP
17
star
2

laravel-elixir-mjml

A task plugin for running MJML templates in Laravel Elixir
JavaScript
11
star
3

hexavel

A modified version of the Laravel Framework
PHP
7
star
4

openai-laravel-demo

A demo app for using OpenAI with Laravel
PHP
7
star
5

macros-demo

A Demo for Macros
PHP
7
star
6

nova-social-login-demo

A demo for how to implement Social Logins for Laravel Nova
PHP
5
star
7

notifications-demo

The code in this project is an example of how to create a simple streamlined email unsubscribe mechanism for Laravel's notification system
PHP
5
star
8

hieroglyph

A package to simplify changing between different icon sets
PHP
3
star
9

roadrunner-plugin-template

Template project for a RoadRunner plugin
Go
3
star
10

bitpayclient

An OOP PHP client for interacting with the BitPay API
PHP
2
star
11

validation-rule-demo

The example code for the article https://medium.com/@SlyFireFox/test-driven-development-for-custom-laravel-validation-rules-669d01e34a65
PHP
2
star
12

seo-demo

The code in this project is an example of how to create root level URLs for dynamic content without causing wildcard clashes
PHP
2
star
13

make-command-demo

A demo for making new Make commands in Laravel
PHP
2
star
14

laravel-incident-logs-demo

The example code for the article https://medium.com/@SlyFireFox/laravel-how-to-make-incident-logs-d7fa88e48490
PHP
2
star
15

hexavel-spark

A library for making installs of Spark compatible with Laravel Spark
PHP
1
star
16

torino

An example of a simple Onion address generator
JavaScript
1
star
17

graphaware-reco-client-php

A configurable PHP library for fetching recommendations from a GraphAware Recommendation setup
PHP
1
star
18

waitformysql

A mini golang util for waiting for a mysql database to be up
Go
1
star
19

laravel-casts-examples

A demo for Laravel Custom Casts with common examples for Money, Location/Address and Date Intervals
PHP
1
star
20

testing-trait-hooks-demo

Demo for Trait hooks to use in Test Cases
PHP
1
star
21

custom-make-model-command

A demo for customising the Laravel make model command to use singular table names.
PHP
1
star