Get and List
Get
API calls which return a single resource return a DataTransferObject with the returned data accessible via properties.
$client = $freshBooksClient->clients()->get($accountId, $clientId);
echo $client->organization; // 'FreshBooks'
$client->only('organization')->toArray(); // ['organization' => 'FreshBooks'];
visState
numbers correspond with various states. See
FreshBooks API - Active and Deleted Objects for details.
use amcintosh\FreshBooks\Model\VisState;
echo $client->visState; // '0'
echo $client->visState == VisState::ACTIVE ? 'Is Active' : 'Not Active'; // 'Is Active'
List
API calls which return a list of resources return a DataTransferObject with an array of the resources.
$clients = $freshBooksClient->clients()->list($accountId);
echo $clients->clients[0]->organization; // 'FreshBooks'
foreach ($clients->clients as $client) {
echo $client->organization;
}