Overview
Learn how to sync the visitor with your authenticated user.
This interface abstracts how the SDK discovers the authenticated user of your application.
Register an implementation when you create the SDK. The SDK then reconciles the visitor with the resolved user on every request, so you do not have to update the identity manually.
Usage
Implement the interface to resolve the current user from your authentication system:
12345678910
<?phpuse Croct\Plug\IdentityResolver;
final class SessionIdentityResolver implements IdentityResolver{ public function getUserId(): ?string { return $_SESSION['user_id'] ?? null; }}