Skip to content

Commit e4b26ce

Browse files
author
ariefkahfi
committed
remove async API
1 parent 0267b43 commit e4b26ce

File tree

5 files changed

+1
-259
lines changed

5 files changed

+1
-259
lines changed

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"description": "Simple HTTP client built on curl",
44
"type": "library",
55
"require": {
6-
"guzzlehttp/promises": "^1.3"
76
},
87
"autoload": {
98
"psr-4": {

composer.lock

-69
This file was deleted.

promise.php

-58
This file was deleted.

readme.md

+1-57
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ echo ("\n" . $raw . "\n");
4040
More example below...
4141

4242

43-
### Example of synchronous request
43+
### More Examples...
4444
```
4545
4646
// ex .1
@@ -76,60 +76,4 @@ $postForm->send(array(
7676
$raw = $postForm->rawResponse();
7777
echo ("\n" . $raw . "\n");
7878
79-
```
80-
81-
### Example of asynchronous request (based on Guzzle promises)
82-
83-
```
84-
// GET Async http client example
85-
$atticaPromise = new AtticaPromise();
86-
$wrongUrl = $atticaPromise->asyncGET("blasdaosd");
87-
88-
var_dump("before wrongUrl...");
89-
$wrongUrl->then(function($v) {
90-
var_dump($v);
91-
});
92-
var_dump("after wrongUrl...");
93-
94-
95-
try {
96-
$wrongUrl->wait();
97-
var_dump("promise resolved");
98-
}catch(Exception $ex){
99-
var_dump($ex->getMessage());
100-
}
101-
102-
// POST Async http client example (application/json)
103-
// chaining promises
104-
$m = $atticaPromise->asyncSendPOST("https://reqres.in/api/users",array(
105-
'name'=>'hello',
106-
'job'=>'world'
107-
),"application/json");
108-
109-
$m->then(function($v) use ($atticaPromise){
110-
echo $v . "\n";
111-
return $atticaPromise->asyncSendPOST("http://httpbin.org/post",array(
112-
'a'=>'aaa','b'=>'bbb'
113-
),'application/x-www-form-urlencoded')->wait();
114-
})->then(function($v) {
115-
echo $v . "\n";
116-
});
117-
118-
$m->wait();
119-
120-
// POST Async with asyncRequest example
121-
$data = http_build_query(array(
122-
'name'=>'asd',
123-
'job'=>'dsa'
124-
));
125-
$headers = array(
126-
'Content-type: application/x-www-form-urlencoded'
127-
);
128-
$custom = $atticaPromise->asyncRequest("http://httpbin.org/post",$headers , CURLOPT_POST , $data);
129-
$custom->then(function($v){
130-
echo $v;
131-
});
132-
133-
$custom->wait();
134-
13579
```

src/Felis/Attica/AtticaPromise.php

-74
This file was deleted.

0 commit comments

Comments
 (0)