Skip to content

Commit 19b2fea

Browse files
committed
Data pipelining documentation
1 parent 7ea0cd3 commit 19b2fea

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,23 @@ $client->setModel($model)->fetchModel()->post("https://example.com");
5757
// You can also use short variant
5858
$client->fetchModel($model)->post("https://example.com");
5959
```
60+
61+
### Data pipelining
62+
If `illuminate/pipeline` is installed, you can send your data through pipelines.
63+
If not, you can still pass your data to [Closure](https://www.php.net/manual/en/class.closure.php)
64+
```php
65+
$response = $client->get("https://example.com");
66+
67+
// Pass data to Closure
68+
$response->then(function ($data) {
69+
return $data;
70+
});
71+
72+
// Use Laravel pipelines
73+
$pipes = [
74+
ExamplePipe::class
75+
];
76+
$response->pipeline()->through($pipes)->then(function ($data) {
77+
return $data;
78+
});
79+
```

0 commit comments

Comments
 (0)