sirsquall / Buzz by sirsquall
forked from kriswallsmith/Buzz

Laravel Lightweight HTTP client
2,059
6
2
Package Data
Maintainer Username: sirsquall
Maintainer Contact: alcindo.dacosta@gmail.com (Alcindo Da Costa)
Package Create Date: 2014-06-05
Package Last Update: 2014-06-11
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-17 15:03:27
Package Statistics
Total Downloads: 2,059
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 6
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Forked from : https://github.com/kriswallsmith/Buzz

Laravel : Buzz is a lightweight PHP 5.3 library for issuing HTTP requests.

Installing via Composer

Update your project's composer.json file to include Buzz:

{
    "require": {
        "sirsquall/buzz": "v0.12"
    }
}

Run the Composer update comand

$ composer update

In your config/app.php add 'Buzz\BuzzServiceProvider' to the end of the $providers array

'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    'Buzz\BuzzServiceProvider',

),

At the end of config/app.php add 'Buzz' => 'Buzz\Buzz' to the $aliases array

'aliases' => array(

    'App'        => 'Illuminate\Support\Facades\App',
    'Artisan'    => 'Illuminate\Support\Facades\Artisan',
    ...
   'Buzz'            => 'Buzz\Buzz',

),

To override the default configuration options you can publish the config file.

php artisan config:publish sirsquall/buzz

You may now edit these options at app/config/packages/sirsquall/buzz/config.php.

<?php

$response = Buzz::get('http://www.google.com');
echo $response;
echo $response->getContent;

You can also use the low-level HTTP classes directly.

<?php

$request = new Buzz\Message\Request('HEAD', '/', 'http://google.com');
$response = new Buzz\Message\Response();

$client = new Buzz\Client\FileGetContents();
$client->send($request, $response);

echo $request;
echo $response;