1. Go to this page and download the library: Download ledgefarm/ledgefarmcore 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/ */
ledgefarm / ledgefarmcore example snippets
use Ledgefarm\LedgefarmCore\LedgefarmCore;
function __construct()
{
LedgefarmCore::setGlobalConfigurations(
'lf_core_test_6847437634763763476343763376237632276',
'https://LedgefarmCore.com/api/v2',
'op1.crt',
'op1.key',
'abcd1234'
);
}
use Ledgefarm\LedgefarmCore\Wallet;
use Ledgefarm\LedgefarmCore\Fee;
use Ledgefarm\LedgefarmCore\Operator;
use Ledgefarm\LedgefarmCore\Token;
use Ledgefarm\LedgefarmCore\Transaction;
use SebastianBergmann\Exporter\Exception;
public $feeObj;
class Client {
public function __construct()
{
$this->feeObj = new Fee('q1w2e37ur4t6', '0.1', 'operator fee');
}
public function create()
{
try
{
$wallet = new Wallet('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dc');
$resp = $wallet->create('q1w2e37ur4t5', 'test', '[email protected]', '+91', '12345678', 'avatar', true);
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
}
public function get()
{
try
{
$wallet = new Wallet('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dc');
$resp = $wallet->get('q1w2e37ur4t5');
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
public function getAll()
{
try
{
$wallet = new Wallet('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dc');
$resp = $wallet->getAll(10, 1);
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
public function update()
{
try
{
$wallet = new Wallet('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dc');
$resp = $wallet->update('q1w2e37ur4t5', 'testUser', '[email protected]', '+91', '12345678', 'avatar', true, false);
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
public function search()
{
try
{
$wallet = new Wallet('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dc');
$resp = $wallet->search('12345678', '+91');
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
public function get()
{
try
{
$operator = new Operator('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dc');
$resp = $operator->get();
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
public function ownedToken()
{
try
{
$operator = new Operator('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dc');
$resp = $operator->ownedToken();
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
public function issuedToken()
{
try
{
$operator = new Operator('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dc');
$resp = $operator->issuedToken();
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
public function issue()
{
try
{
$token = new Token('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dc');
$feeArray = array($this->feeObj);
$resp = $token->issue('q1w2e37ur4t5', 'USD', 1, $feeArray);
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
public function transfer()
{
try
{
$token = new Token('lf_core_test_445e4s5C453srtrtarg3s9sHsrtr34trqL4yjsWsD34sffarjtT1zdfp7dd');
$feeArray = array($this->feeObj);
$resp = $token->transfer('q1w2e37ur4t5', 'USD', 1, $feeArray);
print_r($resp);
}
catch(Exception $e)
{
echo $e->getMessage();
}
}