Coder Social home page Coder Social logo

gapple / guzzle-silex-extension Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guzzle3/guzzle-silex-extension

0.0 3.0 0.0 150 KB

A Silex extension for Guzzle (a PHP HTTP client and web service framework)

Home Page: http://www.guzzlephp.org/

PHP 100.00%

guzzle-silex-extension's Introduction

Guzzle Silex Service Provider

The GuzzleServiceProvider provides a Guzzle ServiceBuilder and default Client object through Michael Dowling’s Guzzle framework. Guzzle is a PHP HTTP client and framework for building RESTful web service clients.

You will need to install a copy of Guzzle in order to use this service provider.

Parameters

  • guzzle.services: (optional) array|string|SimpleXMLElement Data describing your web service clients. You can pass the path to a file (.js|.json|.php), an array of data, or an instantiated SimpleXMLElement containing configuration data. See the Guzzle docs for more info.
  • guzzle.base_url: (optional) The base url for the default web service client. When left out, the actual calls made must use absolute URLs.
  • guzzle.plugins: (optional) An array of guzzle plugins to register with the client.

Services

  • guzzle: An instantiated Guzzle ServiceBuilder.
  • guzzle.client: A default Guzzle web service client using the base URL.

Registering

require __DIR__ . '/../silex.phar';
require __DIR__ . '/../vendor/Guzzle/GuzzleServiceProvider.php';

use Silex\Application;
use Guzzle\GuzzleServiceProvider;

$app = new Application();

$app->register(new GuzzleServiceProvider(), array(
    'guzzle.services' => '/path/to/services.json',
));

Example Usage

Using the instantiated ServiceBuilder:

// Get a command "foo" from "my_client"
$result = $app['guzzle']['my_client']->getCommand('foo');
$result = $foo->execute();

Using the Guzzle client:

$response = $app['guzzle.client']->head('http://www.guzzlephp.org')->send();

More information

More information about Guzzle ServiceBuilders can be found at http://docs.guzzlephp.org/en/latest/webservice-client/using-the-service-builder.html

guzzle-silex-extension's People

Contributors

darklow avatar franmomu avatar igorw avatar jeremeamia avatar jjungnickel avatar lightglitch avatar mtdowling avatar

Watchers

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