aminin / blockchain-bundle
Symfony 2/3/4 的区块链API集成
v0.3.0
2018-03-27 15:05 UTC
Requires
- blockchain/blockchain: ^1.4
- symfony/framework-bundle: ^2.8|^3.0|^4.0
Requires (Dev)
- phpunit/phpunit: ^6.4
- squizlabs/php_codesniffer: ^3.0
This package is not auto-updated.
Last update: 2024-09-15 04:36:47 UTC
README
Symfony 2/3/4 的 Blockchain.info 集成。此包将 Blockchain API 客户端(Blockchain API client)集成到 Symfony 项目中。
先决条件
此版本的包需要 Symfony 2.8+。
安装
步骤 1:使用 composer 下载 AmiBlockchainBundle
在您的 composer.json 中添加 AmiBlockchainBundle
$ composer require aminin/blockchain-bundle
步骤 2:启用包
在 kernel 中启用包
如果使用 SF4 和 Flex,则无需手动添加,包将自动添加。
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Ami\BlockchainBundle\AmiBlockchainBundle(), ); }
步骤 3:配置 AmiBlockchainBundle
将以下配置添加到您的 config.yml
文件中
# app/config/config.yml ami_blockchain: api_key: YOUR-API-KEY service_url: SERVICE-URL-FOR-API-V-2
如果使用 SF4,请在 config/packages
内部为该包创建配置文件
# config/packages/ami_blockchain.yaml ami_blockchain: api_key: YOUR-API-KEY service_url: SERVICE-URL-FOR-API-V-2 # If you like to define this values in `.env` file or your server environment variables use: api_key: '%env(BLOCKCHAIN_API_KEY)%' service_url: '%env(BLOCKCHAIN_SERVICE_URL)%'
用法
您可以通过 ami_blockchain.blockchain
服务访问 Blockchain。
/** @var ContainerInterface $container */ $container->get('ami_blockchain.blockchain')->…;
许可协议
此包采用 MIT 许可协议。请参阅完整的许可协议,见 Resources/meta/LICENSE。
参考
区块链 API 客户端:https://github.com/blockchain/api-v1-client-php