2017 © Pedro Peláez
 

library http

HTTP client independent PSR7 implementation

image

simplon/http

HTTP client independent PSR7 implementation

  • Monday, May 7, 2018
  • by fightbulc
  • Repository
  • 1 Watchers
  • 0 Stars
  • 162 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 6 % Grown

The README.md

     _                 _               _     _   _         
 ___(_)_ __ ___  _ __ | | ___  _ __   | |__ | |_| |_ _ __  
/ __| | '_ ` _ \| '_ \| |/ _ \| '_ \  | '_ \| __| __| '_ \ 
\__ \ | | | | | | |_) | | (_) | | | | | | | | |_| |_| |_) |
|___/_|_| |_| |_| .__/|_|\___/|_| |_| |_| |_|\__|\__| .__/ 
                |_|                                 |_|    

Example

use Psr\Http\Message\ResponseInterface;
use Simplon\Http\Adapter\GuzzleHttp;
use Simplon\Http\HttpInterface;
use Simplon\Http\Strategies\JsonRequestStrategy;

//
// some class
//

class SomeHttp
{
    /**
     * @var HttpInterface
     */
    private $http;

    /**
     * @param HttpInterface $http
     */
    public function __construct(HttpInterface $http)
    {
        $this->http = $http;
    }

    /**
     * @return ResponseInterface
     * @throws Exception
     * @throws \Http\Client\Exception
     */
    public function register(): ResponseInterface
    {
        $request = $this->http->buildRequest('POST', 'http://someapi.com/1.0/register');
        JsonRequestStrategy::create($request, ['token' => '00RVS2CI7K1S']);

        return $this->http->sendRequest($request);
    }
}

$foo = new SomeHttp(new GuzzleHttp());
$response = $foo->register();

//
// print response
//

var_dump($response->getBody()->getContents());

License

Cirrus is freely distributable under the terms of the MIT license., (*1)

Copyright (c) 2017 Tino Ehrich (tino@bigpun.me), (*2)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:, (*3)

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software., (*4)

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE., (*5)

The Versions

07/05 2018

dev-master

9999999-dev https://github.com/fightbulc/simplon_http

HTTP client independent PSR7 implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

07/05 2018

0.0.12

0.0.12.0 https://github.com/fightbulc/simplon_http

HTTP client independent PSR7 implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

07/02 2018

0.0.11

0.0.11.0 https://github.com/fightbulc/simplon_http

HTTP client independent PSR7 implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

07/02 2018

0.0.10

0.0.10.0 https://github.com/fightbulc/simplon_http

HTTP client independent PSR7 implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

19/12 2017

0.0.9

0.0.9.0 https://github.com/fightbulc/simplon_http

HTTP client independent PSR7 implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

19/12 2017

0.0.8

0.0.8.0 https://github.com/fightbulc/simplon_http

HTTP client independent PSR7 implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

19/12 2017

0.0.7

0.0.7.0 https://github.com/fightbulc/simplon_http

HTTP client independent PSR7 implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

11/12 2017

0.0.6

0.0.6.0 https://github.com/fightbulc/simplon_http

HTTP client independent PSR7 implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

04/12 2017

0.0.5

0.0.5.0 https://github.com/fightbulc/simplon_http

HTTP client independent PSR7 implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

01/12 2017

0.0.4

0.0.4.0 https://github.com/fightbulc/simplon_http

Client independent psr7 http implementation

  Sources   Download

MIT

The Requires

 

by Tino Ehrich

http psr7 client

30/11 2017

0.0.3

0.0.3.0 https://github.com/fightbulc/simplon_http

Client independent psr7 http implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tino Ehrich

http psr7 client

30/11 2017

0.0.2

0.0.2.0 https://github.com/fightbulc/simplon_http

Client independent psr7 http implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tino Ehrich

http psr7 client

30/11 2017

0.0.1

0.0.1.0 https://github.com/fightbulc/simplon_http

Client independent psr7 http implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tino Ehrich

http psr7 client