Skip to content

Commit

Permalink
Merge pull request #5 from jcandan/4-update-to-guzzle-six
Browse files Browse the repository at this point in the history
Update to Guzzle 6
  • Loading branch information
kilhage committed Apr 17, 2019
2 parents 554c986 + 05073f9 commit b0f59c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
},
"require": {
"php": ">=5.4.0",
"guzzlehttp/guzzle": "~5.1"
"guzzlehttp/guzzle": "~6.0"
}
}
13 changes: 6 additions & 7 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ private function getClient()
{
if (null === $this->client) {
$this->client = new \GuzzleHttp\Client([
'defaults' => [
'headers' => [
'Authorization' => $this->token
]
]
'base_uri' => 'https://api.pexels.com/v1/',
'headers' => [
'Authorization' => $this->token
]
]);
}

Expand All @@ -52,10 +51,10 @@ private function getClient()
*/
public function search($query, $size = 15, $page = 1)
{
return $this->getClient()->get('http://api.pexels.com/v1/search?'.http_build_query([
return $this->getClient()->get('search?'.http_build_query([
'query' => $query,
'per_page' => $size,
'page' => $page
]));
]));
}
}

0 comments on commit b0f59c1

Please sign in to comment.