Skip to content

Instantly share code, notes, and snippets.

@mikedfunk
Created October 21, 2015 20:59
Show Gist options
  • Save mikedfunk/af06f41f3e9e2ed965fc to your computer and use it in GitHub Desktop.
Save mikedfunk/af06f41f3e9e2ed965fc to your computer and use it in GitHub Desktop.
How to use GuzzleHTTP 6.1
<?php
// in a method...
$this->client = new GuzzleHttp\Client(['base_uri' => 'my_base_uri']);
$config = [
'auth' => [$this->username, $this->password],
'headers' => [
'x-app-id' => $this->appId,
],
'json' => [
// boomtrain's id. If left blank it will search by email then
// app_member_id
'bsin' => '',
'email' => $userData['email'],
'app_member_id' => $userData['id'],
'firstName' => $userData['first_name'],
'lastName' => $userData['last_name'],
'attributes' => $this->getAttributes($userData),
],
];
return $this->client->put('persons', $config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment