Skip to content

Initial import #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 2, 2015
Merged
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ php:
matrix:
allow_failures:
- php: 7.0
- php: hhvm
include:
- php: 5.4
env:
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
}
],
"require": {
"php": ">=5.4"
"php": ">=5.4",
"psr/http-message": "^0.10"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
Expand Down
142 changes: 142 additions & 0 deletions src/HttpAdapter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<?php

/*
* This file is part of the Http Adapter package.
*
* (c) Eric GELOEN <[email protected]>
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/

namespace Http\Adapter;

use Psr\Http\Message\UriInterface;
use Psr\Http\Message\ResponseInterface;

/**
* @author GeLo <[email protected]>
*/
interface HttpAdapter extends PsrHttpAdapter
{
/**
* Sends a GET request
*
* @param string|UriInterface $uri
* @param string[] $headers
*
* @throws HttpAdapterException If an error occurred.
*
* @return ResponseInterface
*/
public function get($uri, array $headers = []);

/**
* Sends an HEAD request
*
* @param string|UriInterface $uri
* @param string[] $headers
*
* @throws HttpAdapterException If an error occurred.
*
* @return ResponseInterface
*/
public function head($uri, array $headers = []);

/**
* Sends a TRACE request
*
* @param string|UriInterface $uri
* @param string[] $headers
*
* @throws HttpAdapterException If an error occurred.
*
* @return ResponseInterface
*/
public function trace($uri, array $headers = []);

/**
* Sends a POST request
*
* @param string|UriInterface $uri
* @param string[] $headers
* @param array|string $data
* @param array $files
*
* @throws HttpAdapterException If an error occurred.
*
* @return ResponseInterface
*/
public function post($uri, array $headers = [], $data = [], array $files = []);

/**
* Sends a PUT request
*
* @param string|UriInterface $uri
* @param string[] $headers
* @param array|string $data
* @param array $files
*
* @throws HttpAdapterException If an error occurred.
*
* @return ResponseInterface
*/
public function put($uri, array $headers = [], $data = [], array $files = []);

/**
* Sends a PATCH request
*
* @param string|UriInterface $uri
* @param string[] $headers
* @param array|string $data
* @param array $files
*
* @throws HttpAdapterException If an error occurred.
*
* @return ResponseInterface
*/
public function patch($uri, array $headers = [], $data = [], array $files = []);

/**
* Sends a DELETE request
*
* @param string|UriInterface $uri
* @param string[] $headers
* @param array|string $data
* @param array $files
*
* @throws HttpAdapterException If an error occurred.
*
* @return ResponseInterface
*/
public function delete($uri, array $headers = [], $data = [], array $files = []);

/**
* Sends an OPTIONS request
*
* @param string|UriInterface $uri
* @param string[] $headers
* @param array|string $data
* @param array $files
*
* @throws HttpAdapterException If an error occurred.
*
* @return ResponseInterface
*/
public function options($uri, array $headers = [], $data = [], array $files = []);

/**
* Sends a request
*
* @param string|UriInterface $uri
* @param string $method
* @param string[] $headers
* @param array|string $data
* @param array $files
*
* @throws HttpAdapterException If an error occurred.
*
* @return ResponseInterface
*/
public function send($uri, $method, array $headers = [], $data = [], array $files = []);
}
Loading