Skip to content

Commit 3c48090

Browse files
committed
Merge pull request #4 from php-http/initial_import
Initial import
2 parents 7c0d3ed + 96580b7 commit 3c48090

13 files changed

+1619
-1
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ php:
1010
matrix:
1111
allow_failures:
1212
- php: 7.0
13+
- php: hhvm
1314
include:
1415
- php: 5.4
1516
env:

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
}
1212
],
1313
"require": {
14-
"php": ">=5.4"
14+
"php": ">=5.4",
15+
"psr/http-message": "^0.10"
1516
},
1617
"require-dev": {
1718
"phpunit/phpunit": "~4.4"

src/HttpAdapter.php

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Http Adapter package.
5+
*
6+
* (c) Eric GELOEN <[email protected]>
7+
*
8+
* For the full copyright and license information, please read the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Http\Adapter;
13+
14+
use Psr\Http\Message\UriInterface;
15+
use Psr\Http\Message\ResponseInterface;
16+
17+
/**
18+
* @author GeLo <[email protected]>
19+
*/
20+
interface HttpAdapter extends PsrHttpAdapter
21+
{
22+
/**
23+
* Sends a GET request
24+
*
25+
* @param string|UriInterface $uri
26+
* @param string[] $headers
27+
*
28+
* @throws HttpAdapterException If an error occurred.
29+
*
30+
* @return ResponseInterface
31+
*/
32+
public function get($uri, array $headers = []);
33+
34+
/**
35+
* Sends an HEAD request
36+
*
37+
* @param string|UriInterface $uri
38+
* @param string[] $headers
39+
*
40+
* @throws HttpAdapterException If an error occurred.
41+
*
42+
* @return ResponseInterface
43+
*/
44+
public function head($uri, array $headers = []);
45+
46+
/**
47+
* Sends a TRACE request
48+
*
49+
* @param string|UriInterface $uri
50+
* @param string[] $headers
51+
*
52+
* @throws HttpAdapterException If an error occurred.
53+
*
54+
* @return ResponseInterface
55+
*/
56+
public function trace($uri, array $headers = []);
57+
58+
/**
59+
* Sends a POST request
60+
*
61+
* @param string|UriInterface $uri
62+
* @param string[] $headers
63+
* @param array|string $data
64+
* @param array $files
65+
*
66+
* @throws HttpAdapterException If an error occurred.
67+
*
68+
* @return ResponseInterface
69+
*/
70+
public function post($uri, array $headers = [], $data = [], array $files = []);
71+
72+
/**
73+
* Sends a PUT request
74+
*
75+
* @param string|UriInterface $uri
76+
* @param string[] $headers
77+
* @param array|string $data
78+
* @param array $files
79+
*
80+
* @throws HttpAdapterException If an error occurred.
81+
*
82+
* @return ResponseInterface
83+
*/
84+
public function put($uri, array $headers = [], $data = [], array $files = []);
85+
86+
/**
87+
* Sends a PATCH request
88+
*
89+
* @param string|UriInterface $uri
90+
* @param string[] $headers
91+
* @param array|string $data
92+
* @param array $files
93+
*
94+
* @throws HttpAdapterException If an error occurred.
95+
*
96+
* @return ResponseInterface
97+
*/
98+
public function patch($uri, array $headers = [], $data = [], array $files = []);
99+
100+
/**
101+
* Sends a DELETE request
102+
*
103+
* @param string|UriInterface $uri
104+
* @param string[] $headers
105+
* @param array|string $data
106+
* @param array $files
107+
*
108+
* @throws HttpAdapterException If an error occurred.
109+
*
110+
* @return ResponseInterface
111+
*/
112+
public function delete($uri, array $headers = [], $data = [], array $files = []);
113+
114+
/**
115+
* Sends an OPTIONS request
116+
*
117+
* @param string|UriInterface $uri
118+
* @param string[] $headers
119+
* @param array|string $data
120+
* @param array $files
121+
*
122+
* @throws HttpAdapterException If an error occurred.
123+
*
124+
* @return ResponseInterface
125+
*/
126+
public function options($uri, array $headers = [], $data = [], array $files = []);
127+
128+
/**
129+
* Sends a request
130+
*
131+
* @param string|UriInterface $uri
132+
* @param string $method
133+
* @param string[] $headers
134+
* @param array|string $data
135+
* @param array $files
136+
*
137+
* @throws HttpAdapterException If an error occurred.
138+
*
139+
* @return ResponseInterface
140+
*/
141+
public function send($uri, $method, array $headers = [], $data = [], array $files = []);
142+
}

0 commit comments

Comments
 (0)