File tree 3 files changed +176
-170
lines changed
3 files changed +176
-170
lines changed Original file line number Diff line number Diff line change @@ -39,14 +39,14 @@ $http->fetch("http://example.com/api/something.json")
39
39
if(!$response->ok) {
40
40
echo "Looks like there was a problem. Status code: "
41
41
. $response->getStatusCode() . PHP_EOL;
42
- return;
42
+ return null ;
43
43
}
44
44
45
45
// Within this Promise callback, you have access to the body stream, but
46
46
// to access the contents of the whole body, return a new Promise here:
47
47
return $response->json();
48
48
})
49
- ->then(function($json) {
49
+ ->then(function(Json $json) {
50
50
// The second Promise resolves once the whole body has completed downloading.
51
51
echo "Got JSON result length "
52
52
. count($json->results)
Original file line number Diff line number Diff line change 1
1
{
2
- "repositories" : [
3
- {
4
- "type" : " path" ,
5
- "url" : " /home/g105b/Code/PhpGt/*"
6
- }
7
- ],
8
- "minimum-stability" : " dev" ,
9
-
10
2
"name" : " phpgt/fetch" ,
11
3
"description" : " Asynchronous HTTP client with promises for PHP 7 applications." ,
12
4
"type" : " library" ,
21
13
"php" : " >=7.2" ,
22
14
"ext-curl" : " *" ,
23
15
"ext-json" : " *" ,
24
- "phpgt/http" : " dev-master@dev " ,
25
- "phpgt/curl" : " dev-master@dev " ,
16
+ "phpgt/http" : " * " ,
17
+ "phpgt/curl" : " * " ,
26
18
27
19
"php-http/httplug" : " ^2.0" ,
28
20
"react/promise" : " 2.*" ,
You can’t perform that action at this time.
0 commit comments