bc-automotive/master-api-client
最新稳定版本:v1.0.0
Composer 安装命令:
composer require bc-automotive/master-api-client
包简介
bFlash Master Api Client
README 文档
README
The bc-automotive/master-api-client package is a library that eases integration of the bFlash Master API in your site.
Installation
Install the package via composer:
composer require bc-automotive/master-api-client
Usage
The api uses authentication using a bearer token. Contact bFlash support to request your authentication token.
Encrypt a slave file:
use \BcAutomotive\MasterApiClient\MasterApiClient; $client = new MasterApiClient($apiKey); $data = file_get_contents('/path/to/data.bdc'); $encrypted = $client->encrypt($data, $slaveName); file_put_contents('/path/to/data.sbdc', $encrypted['data']);
Decrypt a slave file:
use \BcAutomotive\MasterApiClient\MasterApiClient; $client = new MasterApiClient($apiKey); $data = file_get_contents('/path/to/data.sbdc'); $decrypted = $client->decrypt($data); file_put_contents('/path/to/data.sbdc', $decrypted['data']);
Laravel Integration
The package has a laravel service provider and facade to ease integration, so after including the package inside your laravel project, you can add the key to the .env file
MASTER_API_KEY=your_key_here
And use the facade:
use MasterApiClient; $encrypted = MasterApiClient::encrypt($data, $slaveName); $decrypted = MasterApiClient::decrypt($data);
Exceptions
The MasterApiClient class is a small wrapper around the Guzzle http client library, so this class can throw all
regular Guzzle exceptions as well. You can file the Guzzle docs here.
License
统计信息
- 总下载量: 225
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-28