1. Go to this page and download the library: Download asika/clerk-php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use GuzzleHttp\Psr7\Request;
use Clerk\Backend\Helpers\Jwks\AuthenticateRequestOptions;
use Clerk\Backend\Helpers\Jwks\AuthenticateRequest;
use Clerk\Backend\Helpers\Jwks\RequestState;
class UserAuthentication
{
public static function isSignedIn(Request $request): bool
{
$options = new AuthenticateRequestOptions(
secretKey: getenv("CLERK_SECRET_KEY"),
authorizedParties: ["https://example.com"]
);
$requestState = AuthenticateRequest::authenticateRequest($request, $options);
return $requestState.isSignedIn();
}
}