PHP code example of turtlecoin / laravel-turtlecoin-services

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

    

turtlecoin / laravel-turtlecoin-services example snippets


echo TurtleCoin::node()->getHeight();

> {"height":948526,"network_height":948526,"status":"OK"}

echo TurtleCoin::wallet()->getBalance($walletAddress);

> {"id":0,"jsonrpc":"2.0","result":["availableBalance":100,"lockedAmount":50]}

$response = TurtleCoin::wallet()->getBalance($walletAddress);

// The result field from the RPC response
$response->result();

array:2 [▼
  "availableBalance" => 10000
  "lockedAmount" => 0
]

$response = TurtleCoin::wallet()->getBalance($walletAddress);

// Full RPC response as JSON string
$response->toJson();

// Full RPC response as an array
$response->toArray();

// Or other response details
$response->getStatusCode();
$response->getProtocolVersion();
$response->getHeaders();
$response->hasHeader($header);
$response->getHeader($header);
$response->getHeaderLine($header);
$response->getBody();

php artisan vendor:publish --tag=turtlecoin

php artisan turtlecoin:create-wallet

php artisan turtlecoin:start-wallet

php artisan turtlecoin:start-wallet --background-process