mblsolutions/inspireddeck-php-laravel

Laravel PHP应用程序的官方Inspired Deck接口。

v2.2.1 2024-01-24 11:44 UTC

README

Inspired Deck接口为Laravel应用程序提供了一个API接口,以便访问Inspired Deck平台。

集成应用程序

Inspired Deck为集成者提供了一个接口来管理自己的安全凭证集。此接口可在Inspired Deck门户的“集成”菜单项中访问。

安装

推荐通过 Composer 安装Inspired Deck Laravel。

composer require mblsolutions/inspireddeck-php-laravel

没有自动发现功能的Laravel

如果您不使用自动发现,请将ServiceProvider添加到config/app.php中的providers数组中

\MBLSolutions\InspiredDeckLaravel\InspiredDeckServiceProvider::class,

如果您想使用认证的facade,请在app.php中的facades添加以下内容

'InspiredDeckAuth' => \MBLSolutions\InspiredDeckLaravel\InspiredDeckAuthFacade::class,

用法

使用发布命令将包配置复制到本地配置

php artisan vendor:publish --provider="MBLSolutions\InspiredDeckLaravel\InspiredDeckServiceProvider"

将生成一个新的配置文件在 config/inspireddeck.php,请熟悉在 .env 中设置的可用环境变量。

ID_ENDPOINT=https://inspireddeck.co.uk
ID_CLIENT_ID=1
ID_SECRET=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBmOGMwNDAxZDAy

认证

使用Authentication对象上的login方法对Inspired Deck进行认证。

$deckAuthentication = new \MBLSolutions\InspiredDeckLaravel\Authentication;

$deckAuthentication->login('john.doe@example.com', 'password');

认证成功后,认证信息将被存储在inspireddeck配置中指定的会话键中。

检查认证/发行交易

$deckAuthentication = new \MBLSolutions\InspiredDeckLaravel\Authentication;

if (!$deckAuthentication->isAuthenticated()) {
    $deckAuthentication->login('john.doe@example.com', 'password');
}

// Perform transaction
$balance = new \MBLSolutions\InspiredDeck\Balance;

$result = $balance->balance([
    'serial' => 123456789
]);

进一步文档

有关发行交易的更多信息,请参阅PHP的Inspired Deck接口

许可证

Inspired Deck接口为Laravel是免费软件,根据MIT许可证条款分发。

要使用此包,需要Inspired Deck的合同/订阅,有关更多信息请联系 MBL Solutions