Skip to content

Commit

Permalink
Include PHP as example language
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed May 2, 2019
1 parent 0aa737a commit c581476
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions resources/views/partials/example-requests/php.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
```php

$client = new \GuzzleHttp\Client();
$response = $client->{{ strtolower($route['methods'][0]) }}("{{ $route['boundUri'] }}", [
@if(!empty($route['headers']))
'headers' => [
@foreach($route['headers'] as $header => $value)
"{{$header}}" => "{{$value}}",
@endforeach
],
@endif
@if(!empty($route['cleanQueryParameters']))
'query' => [
@foreach($route['cleanQueryParameters'] as $parameter => $value)
"{{$parameter}}" => "{{$value}}",
@endforeach
],
@endif
@if(!empty($route['cleanBodyParameters']))
'json' => [
@foreach($route['cleanBodyParameters'] as $parameter => $value)
"{{$parameter}}" => "{{$value}}",
@endforeach
],
@endif
]);
$body = $response->getBody();
print_r(json_decode((string) $body));
```

0 comments on commit c581476

Please sign in to comment.