PHP code example of cybertines / crypto-laravel
1. Go to this page and download the library: Download cybertines/crypto-laravel 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/ */
cybertines / crypto-laravel example snippets
$service = app(WalletGenerator::class);
$mnemonic = $service->generateSeed();
$service = app(WalletGenerator::class);
$mnemonic = $service->generateSeed();
$path = 0;
$wallet = $service->generate(new CryptoCurrencyCoin(CryptoCurrencyCoin::BTC), $mnemonic, $path);
$walletService = app(WalletGenerator::class);
$mnemonic = $walletService->generateSeed();
$coin = new CryptoCurrencyCoin(CryptoCurrencyCoin::BTC);
$senderWalletDto = $walletService->generate($coin, $mnemonic, 0);
$currency = new Currency(CryptoCurrency::BTC(), new CurrencyNetwork(TokenType::DEFAULT(), 8));
$senderWallet = new Wallet($senderWalletDto->address, $senderWalletDto->privateKey, $currency, $senderWalletDto->pubKey);
$crypto = AbstractCryptoFactory::instanceByCurrency($currency);
$destinationAddressDto = new DestinationAddressDto([
'address' => 'n2k8dJGvQa9Z4G5gPDogKPsopbvoGoJmaR',
'amount' => 0.0001
]);
$transaction = $crypto->createTransaction($senderWallet)->create($destinationAddressDto);
$result = $crypto->broadcastTransaction($transaction);