GithubHelp home page GithubHelp logo

buzz's Introduction

Buzz - Scripted HTTP browser

Build Status Latest Version Code Coverage Quality Score Total Downloads Monthly Downloads

Buzz is a lightweight (<1000 lines of code) PHP 7.1 library for issuing HTTP requests.

Installation

Package available on Composer.

Install by running:

composer require kriswallsmith/buzz

Usage

This page will just show you the basics, please read the full documentation.

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

echo $browser->getLastRequest()."\n";
// $response is a PSR-7 object. 
echo $response->getStatusCode(); 

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

$request = new PSR7Request('GET', 'https://google.com/foo');

$client = new Buzz\Client\FileGetContents();
$response = $client->send($request, ['timeout' => 4]);

echo $response->getStatusCode();

The Idea of Buzz

Buzz was created by Kris Wallsmith back in 2010. The project grown very popular over the years with more than 7 million downloads.

Since August 2017 Tobias Nyholm is maintaining this library. The idea of Buzz will still be the same, we should have a simple API and mimic browser behavior for easy testing. We should not reinvent the wheel and we should not be as powerful and flexible as other clients (ie Guzzle). We do, however, take performance very seriously.

We do love PSRs and this is a wish list of what PSR we would like to support:

  • PSR-1 (Code style)
  • PSR-2 (Code style)
  • PSR-4 (Auto loading)
  • PSR-7 (HTTP messages)
  • PSR-17 (HTTP factories)
  • PSR-18 (HTTP client)

Backwards Compatibility Promise

We take backwards compatibility very seriously as you should do with any open source project. We strictly follow Semver. Please note that Semver works a bit different prior version 1.0.0. Minor versions prior 1.0.0 are allow to break backwards compatibility.

Being greatly inspired by Symfony's bc promise, we have adopted their method of deprecating classes, interfaces and functions.

Running the tests

To run the test we need to set up a webserver. Using PHP's build in one works perfectly.

vendor/bin/http_test_server > /dev/null 2>&1 &
php -S 127.0.0.1:8080 tests/server.php  &
composer test

buzz's People

Contributors

kriswallsmith avatar nyholm avatar stloyd avatar seldaek avatar troelskn avatar gelolabs avatar dol avatar rybakit avatar jfsimon avatar koc avatar peterfrankjohnson avatar honzatrtik avatar mheap avatar relo-san avatar marijn avatar everzet avatar stof avatar bburnichon avatar asm89 avatar lsmith77 avatar dontub avatar vinkla avatar tarlepp avatar squazic avatar sverraest avatar rndstr avatar royopa avatar milad avatar snpy avatar makasim avatar

Watchers

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