Blockchain.info integration for Symfony 2/3/4. This bundle plugs the Blockchain API client into Symfony project.
This version of the bundle requires Symfony 2.8+
Add AmiBlockchainBundle in your composer.json:
$ composer require aminin/blockchain-bundle
Enable the bundle in the kernel:
Skip if using SF4 and Flex, the bundle will be automatically added for you.
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Ami\BlockchainBundle\AmiBlockchainBundle(),
);
}
Add the following configuration to your config.yml
file
# app/config/config.yml
ami_blockchain:
api_key: YOUR-API-KEY
service_url: SERVICE-URL-FOR-API-V-2
If using SF4 create the config file for this bundle inside 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)%'
You may access the Blockchain as ami_blockchain.blockchain
service
/** @var ContainerInterface $container */
$container->get('ami_blockchain.blockchain')->…;
This bundle is under the MIT license. See the complete license in the Resources/meta/LICENSE
Blockchain API client: https://github.com/blockchain/api-v1-client-php