cryptr/cryptr-php

此包已被废弃,不再维护。未建议替代包。

Cryptr 包用于处理 Cryptr 认证过程

0.0.1 2023-01-09 15:27 UTC

README

PHP SDK 用于 Cryptr 认证过程

在我们的在线文档 📚上了解更多信息。

安装

要求

  • PHP 7.3+

安装

使用以下 composer 命令安装我们的 SDK

composer require cryptr/cryptr-php

此 SDK 主要针对 PHP API 应用,确保您的端点安全。

以下是您如何使用它的示例

<?php

require Cryptr\Cryptr;

$yourFetchedTokenFromAuthHeader = 'ey....';
$cryptrBaseUrl = "https://your-company.authent.me";
$allowedOrigins = ["https://www.your-company.com"];

$cryptr = new Cryptr($cryptrBaseUrl, $allowedOrigins);

$cryptr->validateToken($yourFetchedTokenFromAuthHeader) // -> returns true or throw according error

// Be aware that we look for $_ENV['CRYPTR_BASE_URL'] and $_ENV['CRYPTR_ALLOWED_ORIGINS']
// Like that you can just call
$cryptr = new Cryptr();