PHP code example of cfxmarkets / php-public-models
1. Go to this page and download the library: Download cfxmarkets/php-public-models 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/ */
cfxmarkets / php-public-models example snippets
$user = $cfx->users->get("id=abc123");
$name = $user->getName();
$street1 = $user->getAddress()->getStreet1();
$street2 = $user->getAddress()->getStreet2();
$city = $user->getAddress()->getCity();
$state = $user->getAddress()->getState();
$country = $user->getAddress()->getCountry();
$zip = $user->getAddress()->getZip();
$orderIntent = $cfx->orderIntents->create()
->setType('sell')
->setPriceHigh(2.50)
->setPriceLow(2.10)
->setAsset($cfx->assets->get("id=INVT001"))
->setAssetOwner($user->getPersonEntity())
->setBankAccount($user->getBankAccounts()[0])
;
// (This is future functionality not implemented at the time of this writing)
if ($user->isAtLeast('financial-advisor')) {
$orderIntent->setReferralKey($user->getId());
}
$orderIntent->save();
....
bash
composer