dizda/coinegger-client-bundle
最新稳定版本:0.0.12
Composer 安装命令:
composer require dizda/coinegger-client-bundle
包简介
A Symfony2 bundle to interoperate with the Bitdepot bitcoin wallet.
关键字:
README 文档
README
When bitcoin meet Arnold Schwarzenegger.
See the API Project.
Setup
Install with Composer
composer require dizda/bitdepot-client-bundle
Configuration
To active hooks, you must update your routing.yml:
dizda_bitdepot_client: resource: "@DizdaBitdepotClientBundle/Resources/config/routing.yml" prefix: /callback # don't forget to restrict the path you specify in your security.yml
Add this to your config.yml:
dizda_bitdepot_client: base_url: %bitdepot_endpoint% # Correspond to the bitdepot api server app_id: %bitdepot_app_id% app_secret: %bitdepot_app_secret%
Listeners
You probably want to listening all interactions that are made on/by your addresses? It's simple.
DepositListener
An event dizda_bitdepot_client.deposit_callback is dispatched everytime a deposit is made (and reached confirmations you specified).
So, for example, you could create a listener:
<?php // AdvertisingBundle/EventListener/DepositListener.php namespace Dizda\Bundle\AdvertisingBundle\EventListener; use Dizda\BitdepotClientBundle\Event\CallbackEvent; /** * Class DepositListener */ class DepositListener { /** * When a deposit is made, the listener will trigger this hook * * @param CallbackEvent $event */ public function onDepositCallback(CallbackEvent $event) { $data = $event->getData(); if ($data['is_fulfilled'] === false) { // The case when the deposit were not sufficient return; } if ($data['is_overfilled'] === true) { // do something } // The deposit was notified to be successful, so you can do your stuff there $advertiser = $this->em ->getRepository('DizdaAdvertisingBundlee:Advertiser') ->findOneByDepositAddress($data['address_external']['value']) ; // Activate the campaign $advertiser->activate(); // [...] } }
And add the listener to services.xml:
<service id="dizda_advertising.listener.deposit" class="Dizda\Bundle\AdvertisingBundle\EventListener\DepositListener"> <tag name="kernel.event_listener" event="dizda_bitdepot_client.deposit_callback" method="onDepositCallback" /> </service>
That's it!
License
MIT Licensed, see LICENSE.
统计信息
- 总下载量: 951
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-14