Zitadel PHP Client 1.3.6
PHP Client for Zitadel
Loading...
Searching...
No Matches
Delete.php
Go to the documentation of this file.
1<?php
2
4
5use Exception;
6
13class Delete
14{
15 private array $settings;
16 private int $userid;
20 public function __construct(array $settings)
21 {
22 $this->settings = $settings;
23 }
24
29 public function setUserId(int $userid) {
30 $this->userid = $userid;
31 }
32
37 public function delete() {
38 $token = $this->settings["serviceUserToken"];
39 $curl = curl_init();
40 curl_setopt_array($curl, array(
41 CURLOPT_URL => $this->settings["domain"] . "/v2beta/users/$this->userid",
42 CURLOPT_RETURNTRANSFER => true,
43 CURLOPT_ENCODING => "",
44 CURLOPT_MAXREDIRS => 10,
45 CURLOPT_TIMEOUT => 0,
46 CURLOPT_FOLLOWLOCATION => true,
47 CURLOPT_CUSTOMREQUEST => "DELETE",
48 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
49 CURLOPT_HTTPHEADER => array(
50 "Accept: application/json",
51 "Authorization: Bearer $token"
52 )
53 ));
54 $response = json_decode(curl_exec($curl));
55 if(isset($response->code)) {
56 throw new Exception("Error-Code: " . $response->code . " Message: " . $response->message);
57 }
58 curl_close($curl);
59 }
60}
__construct(array $settings)
Definition Delete.php:20