Skip to content

Commit 1c0f3ed

Browse files
committed
Readme
1 parent b1717f7 commit 1c0f3ed

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

README.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
```php
88

9-
$sn = new SecureNative('YOUR_API_KEY', new SecureNativeOptions());
9+
SecureNative::init($API_KEY, new SecureNativeOptions());
1010
```
1111

1212
| Option | Type | Optional | Default Value | Description |
@@ -21,30 +21,34 @@ $sn = new SecureNative('YOUR_API_KEY', new SecureNativeOptions());
2121
## Event tracking
2222

2323
```
24-
$sn->track(array(
25-
'event_type' => EventTypes::LOG_IN,
26-
'ip' => '127.0.0.1',
27-
'userAgent' => 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405',
24+
SecureNative::track(array(
25+
'eventType' => EventTypes::LOG_IN,
26+
'ip' => '137.74.169.241',
27+
'userAgent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ',
2828
'user' => (object)[
29-
'id' => '12345'
29+
'id' => '556595',
30+
'name' => '',
31+
'email' => 'test@test.com'
3032
]
3133
));
3234
3335
or
3436
35-
$sn->track(array(
36-
EventOptions::EVENT_EVENT_TYPE => EventTypes::LOG_IN,
37-
EventOptions::EVENT_IP => '127.0.0.1',
38-
EventOptions::USER_AGENT => 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405',
39-
EventOptions::USER=> (object)[
40-
'id' => '12345'
37+
$ver = SecureNative::verify(array(
38+
'eventType' => EventTypes::VERIFY,
39+
'ip' => '103.234.220.197',
40+
'userAgent' => 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405',
41+
'user' => (object)[
42+
'id' => '12345',
43+
'name' => '',
44+
'email' => 'amit@phptest.com'
4145
]
4246
));
47+
```
4348

49+
Middleware:
4450

45-
middleware:
46-
47-
$body = file_get_contents('php://input');
48-
$sn->middleware->verifySignature($_SERVER, $body)
51+
```php
52+
$res = SecureNative::getMiddleware()->verifySignature();
4953

5054
```

0 commit comments

Comments
 (0)