adrianmejias / factom-api
此包已被废弃,不再维护。未建议替代包。
为 Factom API 提供的简单 Laravel 服务提供者。
v1.4
2017-09-21 22:35 UTC
Requires
- php: ~7.0
- guzzlehttp/guzzle: ~6.0
- illuminate/support: ~5.5.0
Requires (Dev)
- mockery/mockery: ^0.9.4
- phpunit/phpunit: ^6.3
README
此包为 Laravel 框架提供了 Factom API 的简单服务提供者。
Factom API 文档: https://docs.factom.com/api
注意:此包处于开发中,不应在生产环境中使用。
安装
您可以通过 composer 使用以下命令安装此包
composer require adrianmejias/factom-api
您还必须在 conifg/app.php
中安装此服务提供者。
'providers' => [ ... AdrianMejias\FactomApi\FactomApiServiceProvider::class, ...
该包将自动注册自身。如果未自动注册,请在 config/app.php
中添加别名。
'aliases' => [ ... 'FactomApi' => AdrianMejias\FactomApi\Facades\FactomApi::class, 'FactomWalletApi' => AdrianMejias\FactomApi\Facades\FactomWalletApi::class, 'FactomDebugApi' => AdrianMejias\FactomApi\Facades\FactomDebugApi::class, ...
将配置文件发布到 app/config/factom-api.php
php artisan vendor:publish --provider="AdrianMejias\FactomApi\FactomApiServiceProvider"
这将在一个配置目录中发布一个名为 factom-api.php
的文件,其内容如下
<?php return [ /** * Base credentials for Factom server. */ 'url' => env('FACTOM_URL', 'https://:8088/v2'), 'ssl' => [ 'enable' => env('FACTOM_SSL', false), 'certificate' => env('FACTOM_CERTIFICATE', storage_path('app/factomdAPIpub.cert')), ], 'username' => env('FACTOM_USERNAME'), 'password' => env('FACTOM_PASSWORD'), /** * Factom wallet server credentials. */ 'wallet' => [ 'url' => env('FACTOM_WALLET_URL', 'https://:8089/v2'), 'ssl' => [ 'enable' => env('FACTOM_WALLET_SSL', false), 'certificate' => env('FACTOM_WALLET_CERTIFICATE', storage_path('app/factomdAPIpub.cert')), ], 'username' => env('FACTOM_WALLET_USERNAME'), 'password' => env('FACTOM_WALLET_PASSWORD'), ], /** * Factom debug server credentials. */ 'debug' => [ 'url' => env('FACTOM_DEBUG_URL', 'https://:8088/debug'), 'ssl' => [ 'enable' => env('FACTOM_DEBUG_SSL', false), 'certificate' => env('FACTOM_DEBUG_CERTIFICATE', storage_path('app/factomdAPIpub.cert')), ], 'username' => env('FACTOM_DEBUG_USERNAME'), 'password' => env('FACTOM_DEBUG_PASSWORD'), ], ];
使用方法
安装此包并在配置文件中填写值后,使用此包将变得非常简单。以下所有示例都使用了外观。
Route::get('/factom/heights', function() { $result = FactomApi::heights(); return response()->json($result); });
待办事项
用 Guzzle 替换 Curl添加钱包方法- 添加证书认证
- 添加单元测试
测试
使用以下命令运行测试
vendor/bin/phpunit
贡献
请参阅 CONTRIBUTING 了解详情。
安全
如果您发现任何安全问题,请通过电子邮件 adrianmejias@gmail.com 而不是使用问题跟踪器。
鸣谢
许可
MIT 许可证(MIT)。请参阅 许可文件 了解更多信息。