We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent efbf616 commit 6ed6259Copy full SHA for 6ed6259
lib/Facade/Webhook.php
@@ -0,0 +1,38 @@
1
+<?php
2
+/*
3
+ * Webhook Helper
4
+ *
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+
8
+namespace OpenTHC\SSO\Facade;
9
10
+class Webhook {
11
12
+ /**
13
+ * Calls the Webhook, Ignores Response
14
15
+ static function emit(string $action, array $ctx) : void {
16
17
+ $url = \OpenTHC\Config::get('webhook/url');
18
+ if (empty($url)) {
19
+ return;
20
+ }
21
22
+ // PreShared Key
23
+ $psk = \OpenTHC\Config::get('webhook/psk');
24
25
+ $req = _curl_init($url);
26
+ $arg = [];
27
+ $arg['action'] = $action;
28
+ $arg['context'] = $ctx;
29
+ $arg = json_encode($arg);
30
31
+ // From Common
32
+ _curl_post_json($url, $arg, [
33
+ 'authorization' => sprintf('openthc-psk %s', $psk)
34
+ ]);
35
36
37
38
+}
0 commit comments