PHP code example of pashaster12 / laravel-crypto-stats
1. Go to this page and download the library: Download pashaster12/laravel-crypto-stats 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/ */
pashaster12 / laravel-crypto-stats example snippets
/*
* Default cryptocurrencies which user want to use in the application
*/
'currencies' => [
'ETH',
'LTC',
'BTC',
],
/*
* API key for Etherscan connection
*/
'etherscan_api_key' => env('ETHERSCAN_API_KEY'),
use CryptoStat;
// get the list of the default currencies
$currencies = CryptoStat::getCurrencies(); //array in format [ 'ETH', 'BTC', ... ]
// validate the cryptocurrency wallet address
CryptoStat::setCurrency($this->currency);
$is_valid = CryptoStat::validateAddress($value); //bool
// get the cryptocurrency wallet balance
// method returns float number with the 8 decimal digits (chain.so API response format)
CryptoStat::setCurrency($wallet->currency);
$new_balance = CryptoStat::getBalance($wallet->address); //float
// generate links to block explorers
CryptoStat::setCurrency($wallet['currency']);
$block_explorer_link = CryptoStat::getBlockExplorerLink($wallet['address']); //string