PHP code example of dizda / bitdepot-client-bundle

1. Go to this page and download the library: Download dizda/bitdepot-client-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dizda / bitdepot-client-bundle example snippets



// 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();

        // [...]
    }
}