Coder Social home page Coder Social logo

buzy's Introduction

Buzy is an HTTP client for PHP built on top of Symfony2 components

This is a work in progress project. The goal is to build an efficient and robust library on top of Symfony2 HttpFoundation (Request and Response).

Unit tested with PHPUnit Build Status

Todo:

  • HTTP cache listener to skip not necessary requests.
  • CURL client
  • Proxy support
  • History listener
  • Logger listener

Requirements

  • PHP 5.3 +
  • Symfony HttpFoundation
  • Symfony EventDispatcher
  • Symfony BrowserKit (for CookieJar)
  • Curl Extension (not yet)

Usage

$browser = new Buzy\Browser();
$response = $browser->get('http://www.google.com');

echo $response;

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

$request = Symfony\Component\HttpFoundation\Request::create('http://google.com', 'GET');
$response = new Symfony\Component\HttpFoundation\Response();

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

echo $request;
echo $response;

Simple reverse proxy

With this 5 lines of code, you can re-send a request and transfert the response.

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Buzy\Browser;

$request = Request::createFromGlobals();
$request->server->set('HTTP_HOST', 'internal-server');

$browser = new Browser();

$response = $browser->send($request);

$response->send();

// The response is sent back to the client

Licence

Original code base is extracted from Buzz library written by Kris Wallsmith.

This library is shared under MIT licence. See LICENCE file.

buzy's People

Contributors

gromnan avatar gyndav avatar igorw avatar ludofleury avatar

Stargazers

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