Skip to content

Commit

Permalink
Data pipelining documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan770 committed Jun 10, 2019
1 parent 7ea0cd3 commit 19b2fea
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,23 @@ $client->setModel($model)->fetchModel()->post("https://example.com");
// You can also use short variant
$client->fetchModel($model)->post("https://example.com");
```

### Data pipelining
If `illuminate/pipeline` is installed, you can send your data through pipelines.
If not, you can still pass your data to [Closure](https://www.php.net/manual/en/class.closure.php)
```php
$response = $client->get("https://example.com");

// Pass data to Closure
$response->then(function ($data) {
return $data;
});

// Use Laravel pipelines
$pipes = [
ExamplePipe::class
];
$response->pipeline()->through($pipes)->then(function ($data) {
return $data;
});
```

0 comments on commit 19b2fea

Please sign in to comment.