Git Product home page Git Product logo

sensiobuzzbundle's Introduction

SensioBuzzBundle

This bundle provides a simple integration of the "Buzz library" from Kris Wallsmith into Symfony2. Buzz is a lightweight PHP 5.3 library for issuing HTTP requests. You can find more information about Buzz on its dedicated page at https://github.com/kriswallsmith/Buzz.

<?php

$buzz = $this->container->get('buzz');

The bundle provides a new buzz service that returns an instance of Buzz\Browser.

Installation

To install this bundle, you'll need both the Buzz library and this bundle. Installation depends on how your project is setup:

Step 1: Installation using the bin/vendors.php method

If you're using the bin/vendors.php method to manage your vendor libraries, add the following entries to the deps file at the root of your project file:

[buzz]
    git=http://github.com/kriswallsmith/Buzz.git

[SensioBuzzBundle]
    git=http://github.com/sensio/SensioBuzzBundle.git
    target=bundles/Sensio/Bundle/BuzzBundle

Next, update your vendors by running:

$ ./bin/vendors install

Great! Now skip down to Step 2.

Step 1 (alternative): Installation with submodules

If you're managing your vendor libraries with submodules, simply add the two following submodules:

$ git submodule add git://github.com/kriswallsmith/Buzz.git vendor/buzz
$ git submodule add git://github.com/sensio/SensioBuzzBundle.git vendor/bundles/Sensio/Bundle/BuzzBundle

Finally update your submodules:

$ git submodule init
$ git submodule update

Step2: Configure the autoloader

Add the following entries to your autoloader:

<?php
// app/autoload.php

$loader->registerNamespaces(array(
    // ...

    'Buzz'          => __DIR__.'/../vendor/buzz/lib',
    'Sensio'        => __DIR__.'/../vendor/bundles',
));

Step3: Enable the bundle

Finally, enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...

        new Sensio\Bundle\BuzzBundle\SensioBuzzBundle(),
    );
}

Congratulations! You're ready to use Buzz into Symfony2!

Basic Usage

The only thing to do is to request the buzz service from the container to get an instance of Buzz\Browser and start issuing HTTP requests:

<?php

$buzz = $this->container->get('buzz');

$response = $buzz->get('http://google.com');

echo $response->getContent();

Configuration

By default, this bundle configures Buzz to perform HTTP requests with the cURL extension. You must check that the cURL PHP extension is correctly installed on your platform:

$ php -i | grep curl

sensiobuzzbundle's People

Contributors

phiamo avatar ubermuda avatar marcw avatar tomadam avatar

Stargazers

 avatar

Watchers

James Cloos 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.