2017 © Pedro Peláez
 

library http

Http Client for RxPHP

image

rx/http

Http Client for RxPHP

  • Wednesday, April 18, 2018
  • by davidwdan
  • Repository
  • 4 Watchers
  • 19 Stars
  • 898 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 9 Versions
  • 4 % Grown

The README.md

Http Client for RxPHP

This library is a RxPHP wrapper for the ReactPHP's Http-client library. It allows you to make asynchronous http calls and emit the results through an RxPHP observable., (*1)

It uses the Voryx event-loop which behaves like the Javascript event-loop. ie. You don't need to start it., (*2)

Installation

Install dependencies using composer, (*3)

  $ php composer.phar require "rx/http"      

Usage

Get


$source = \Rx\React\Http::get('https://www.example.com/'); $source->subscribe( function ($data) { echo $data, PHP_EOL; }, function (\Exception $e) { echo $e->getMessage(), PHP_EOL; }, function () { echo "completed", PHP_EOL; } );

Post


$postData = json_encode(["test" => "data"]); $headers = ['Content-Type' => 'application/json']; $source = \Rx\React\Http::post('https://www.example.com/', $postData, $headers); $source->subscribe( function ($data) { echo $data, PHP_EOL; }, function (\Exception $e) { echo $e->getMessage(), PHP_EOL; }, function () { echo "completed", PHP_EOL; } );

Multiple Asynchronous Requests


$imageTypes = ["png", "jpeg", "webp"]; $images = \Rx\Observable::fromArray($imageTypes) ->flatMap(function ($type) { return \Rx\React\Http::get("http://httpbin.org/image/{$type}")->map(function ($image) use ($type) { return [$type => $image]; }); }); $images->subscribe( function ($data) { echo "Got Image: ", array_keys($data)[0], PHP_EOL; }, function (\Exception $e) { echo $e->getMessage(), PHP_EOL; }, function () { echo "completed", PHP_EOL; } );

For more information, see the examples., (*4)

The Versions

18/04 2018

dev-master

9999999-dev

Http Client for RxPHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

http react reactphp rxphp reactivex rx.php

18/04 2018

2.1.1

2.1.1.0

Http Client for RxPHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

http react reactphp rxphp reactivex rx.php

10/10 2017

dev-static_constructor

dev-static_constructor

Http Client for RxPHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

http react reactphp rxphp reactivex rx.php

09/10 2017

2.1.0

2.1.0.0

Http Client for RxPHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

http react reactphp rxphp reactivex rx.php

21/03 2017

2.0.2

2.0.2.0

Http Client for RxPHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Bonneau
by David Dan

http react reactphp rxphp reactivex rx.php

14/03 2017

2.0.1

2.0.1.0

Http Client for RxPHP

  Sources   Download

MIT

The Requires

 

by Matt Bonneau
by David Dan

http react reactphp rxphp reactivex rx.php

10/01 2017

2.0.0

2.0.0.0

Http Client for RxPHP

  Sources   Download

MIT

The Requires

 

by Matt Bonneau
by David Dan

http react reactphp rxphp reactivex rx.php

11/03 2016

0.2.0

0.2.0.0

Http Client for RxPHP

  Sources   Download

MIT

The Requires

 

by Matt Bonneau
by David Dan

http react reactphp rxphp reactivex rx.php

06/02 2016

0.1.0

0.1.0.0

Http Client for RxPHP

  Sources   Download

MIT

The Requires

 

by Matt Bonneau
by David Dan

http react reactphp rxphp reactivex rx.php