This is a laravel package for interacting with blockchain api
A Laravel 5 Package for working with blockchain api
PHP 5.4+ or HHVM 3.3+, and Composer are required.
To get the latest version of blockchain api, simply run the code below in your project.
"composer require maxtee/blockchain"
Once Laravel Blockchain is installed, You need to register the service provider. Open up config/app.php
and add the following to the providers
key.
Maxtee\Blockchain\BlockchainServiceProvider::class,
Also, register the Facade like so:
'aliases' => [
...
'Blockchain' => Maxtee\Blockchain\Facades\Blockchain::class,
...
]
You can publish the configuration file using this command:
php artisan vendor:publish --provider="Maxtee\Blockchain\BlockchainServiceProvider"
A configuration-file named blockchain.php
with default settings will be placed in your config
directory:
You can visit this link to get your blockchain api
https://api.blockchain.info/customer/signup
Open your .env file and add the following in this format. Ensure you must have gotten your api key:
BLOCKCHAIN_API=***********************
DEFAULT_BTC_FEE=0.0001
TRANSACTION_BTC_FEE=0.000
Add the following line to your controller
use Blockchain
Blockchain::getRates();
$rates = Blockchain::convertCurrencyToBTC('NGN' 600000);
$rates = Blockchain::getStats();
$wallet = Blockchain::createWallet($wallet_password);
$wallet = Blockchain::getWalletBalance($wallet_guid, $wallet_password);
$wallet = Blockchain::makeOutgoingPayment($wallet_guid, $amount, $wallet_password, $to_guid);
$wallet = Blockchain::listAddress($wallet_guid, $wallet_password);
$wallet = Blockchain::createNewAddress($wallet_guid, $wallet_password, $label ='');
Readme document was inpsired and tuned from one of @Unicodedeveloper. Prosper Otemuyiwa.
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.
Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or HackerNews? Spread the word!
Don't forget to follow me on twitter!
Thanks! Famurewa Taiwo
The MIT License (MIT). Please see License File for more information.