PHP code example of appino / blockchain

1. Go to this page and download the library: Download appino/blockchain 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/ */

    

appino / blockchain example snippets

 php
Appino\Blockchain\BlockchainServiceProvider::class
 php
php artisan vendor:publish --provider="Appino\blockchain\BlockchainServiceProvider"
 php
$blocchain = Blockchain::Create();
 php
/**
 * @param string $password
 * @param string|null $email
 * @param string|null $label
 * @return WalletResponse
 * @throws ParameterError
 */
$blockchain->create($password, $email, $label);
 php
/**
 * @param string $password
 * @param string $privKey
 * @param string|null $email
 * @param string|null $label
 * @return WalletResponse
 * @throws ParameterError
 */
$blockchain->createWithKey($password, $privKey, $email, $label);
 php
$blockchain = Blockchain::Wallet();
$blockchain->credentials($guid, $password);
 php
/**
 * @param null|string $label
 * @return AccountResponse
 */
$blockchain->CreateAddress($label));
 php
/**
 * @return int in satoshi
 */ 
$blockchain->balnce();
 php
/**
 * @param int|string $param can be index of address in wallet or address
 * @return int in satoshi
 */ 
$blockchain->AddressBallance($param);
 php
/**
 * @return array<AccountResponse>
 */ 
$blockchain->ActiveAddresses();
 php
/**
 * @return array<string>
 */ 
$blockchain->XpubList();
 php
/**
 * @param int|string $param can be index of address in wallet or address
 * @return AccountResponse
 */ 
$blockchain->SingleAddress($param);
 php
/**
 * @param int|string $param can be index of address in wallet or address
 * @return string
 */ 
$blockchain->ReceivingAddress($param);
 php
/**
 * @param int|string $param can be index of address in wallet or address
 * @return AccountResponse
 */ 
$blockchain->ArchiveAddress($param);
 php
/**
 * @param int|string $param can be index of address in wallet or address
 * @return AccountResponse
 */ 
$blockchain->UnArchiveAddress($param);
 php
/**
 * @param string $to bitcoin address that you want to send payment to
 * @param integer $amount amount of payment you want to send in satoshi
 * @param integer|string|null $from xpub address or index of account that you want to send payment from
 * @param int|null $fee 
 * @param int|null $fee_per_byte 
 * @return PaymentResponse
 * @throws ParameterError
 */
$blockchain->SendPayment($to, $amount, $from, $fee, $fee_per_byte);
 php
/**
 * @param array<string,integer> $recipients recipients must be an array of address as key and satoshi as integer
 * @param integer|string|null $from xpub address or index of account that you want to send payment from
 * @param integer|null $fee must be in satoshi (better to set null or use fee_per_byte)
 * @param integer|null $fee_per_byte must be in satoshi
 * @return PaymentResponse
 * @throws ParameterError
 */
$blockchain->SendManyPayment($recipients, $from=null, $fee=null, $fee_per_byte = null);
 php
$blocchain = Blockchain::Receive();
` php
/**
 * @param string $xpub The public key.
 * @param string $callback The callback URL.
 * @param int $gap_limit How many unused addresses are allowed.
 * @return ReceiveResponse
 */
 $blockchain->Generate($xpub, $callback, $gap_limit = 20);
` php
/**
 * @param string $address
 * @param string $callback callback url
 * @param Notification|string $on what to do after notification called
 * @param int $confs how many confiramtion need to send notification
 * @param Operation|string $op on Receive/Send/All notification will send
 * @return NotificationResponse
 */
 $blockchain->BalanceNotification($address, $callback, $on, $confs, $op);
` php
/**
 * @param $id int
 * @return bool
 * @throws \GuzzleHttp\Exception\GuzzleException
 */
 $blockchain->DeleteBalanceNotification($id);
` php
/**
 * @param int $id
 * @return bool
 * @throws \GuzzleHttp\Exception\GuzzleException
 */
 $blockchain->DeleteBlockNotification($id);