grom/buzy 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

grom/buzy

最新稳定版本:v0.0.2

Composer 安装命令:

composer require grom/buzy

包简介

Web client on top of Symfony2 HTTP foundation

README 文档

README

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.

统计信息

  • 总下载量: 276
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2012-04-06