Skip to content

Commit a2f214b

Browse files
committed
Added contextFromRequest to main class
1 parent b4d1e71 commit a2f214b

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ SecureNative::init("YOUR_API_KEY", new SecureNativeOptions());
4040
## Event tracking
4141

4242
```
43-
$context = SecureNativeContext::fromRequest();
43+
$context = SecureNative::contextFromContext();
4444
4545
SecureNative::track(array(
4646
'event' => EventTypes::LOG_IN,
@@ -61,7 +61,7 @@ or
6161
6262
$ver = SecureNative::verify(array(
6363
'event' => EventTypes::VERIFY,
64-
'context' => SecureNativeContext::fromRequest(),
64+
'context' => SecureNative::contextFromContext()
6565
'userTraits' => (object)[
6666
'name' => 'Your name',
6767
'email' => 'amit@phptest.com'

src/SecureNative.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public static function flow($flowId, Array $attributes)
6666
$event = self::$eventManager->buildEvent($opts);
6767
return self::$eventManager->sendSync($event, $requestUrl);
6868
}
69+
public static function contextFromContext()
70+
{
71+
return SecureNativeContext::fromRequest();
72+
}
6973

7074
public static function getMiddleware()
7175
{

0 commit comments

Comments
 (0)