vaultUrl = $vaultUrl; } $this->restClient = new RestClient(); } public function login($username, $password) { $response = $this->restClient->post($this->vaultUrl . '/login', [ 'username' => $username, 'password' => $password ]); $this->token = $response->decodeJson()['token']; } public function getSecret($secretPath, $key) { $this->restClient->setHeaders([ 'Content-Type: application/json', 'Authorization: Bearer ' . $this->token ]); $response = $this->restClient->post($this->vaultUrl . '/vault/' . $secretPath, [ 'key' => $key ]); return $response->decodeJson(); } }