File tree Expand file tree Collapse file tree 3 files changed +176
-170
lines changed
Expand file tree Collapse file tree 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")
3939 if(!$response->ok) {
4040 echo "Looks like there was a problem. Status code: "
4141 . $response->getStatusCode() . PHP_EOL;
42- return;
42+ return null ;
4343 }
4444
4545// Within this Promise callback, you have access to the body stream, but
4646// to access the contents of the whole body, return a new Promise here:
4747 return $response->json();
4848})
49- ->then(function($json) {
49+ ->then(function(Json $json) {
5050// The second Promise resolves once the whole body has completed downloading.
5151 echo "Got JSON result length "
5252 . count($json->results)
Original file line number Diff line number Diff line change 11{
2- "repositories" : [
3- {
4- "type" : " path" ,
5- "url" : " /home/g105b/Code/PhpGt/*"
6- }
7- ],
8- "minimum-stability" : " dev" ,
9-
102 "name" : " phpgt/fetch" ,
113 "description" : " Asynchronous HTTP client with promises for PHP 7 applications." ,
124 "type" : " library" ,
2113 "php" : " >=7.2" ,
2214 "ext-curl" : " *" ,
2315 "ext-json" : " *" ,
24- "phpgt/http" : " dev-master@dev " ,
25- "phpgt/curl" : " dev-master@dev " ,
16+ "phpgt/http" : " * " ,
17+ "phpgt/curl" : " * " ,
2618
2719 "php-http/httplug" : " ^2.0" ,
2820 "react/promise" : " 2.*" ,
You can’t perform that action at this time.
0 commit comments