PHP code example of arbor-education / arbor-sdk-php

1. Go to this page and download the library: Download arbor-education/arbor-sdk-php 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/ */

    

arbor-education / arbor-sdk-php example snippets


$httpClient = new \Arbor\Api\Gateway\HttpClient\HttpClient(
    new \Arbor\Api\Gateway\HttpClient\TypedRequestFactory(),
    null,
    null,
    $config['api']['baseUrl'],
    $config['api']['auth']['user'],
    $config['api']['auth']['password']
);

$api = new \Arbor\Api\Gateway\PsrRestGateway(
    $httpClient,
    new \Arbor\Model\Hydrator(),
    new \Arbor\Filter\CamelCaseToDash(),
    new \Arbor\Filter\PluralizeFilter(),
);

\Arbor\Model\ModelBase::setDefaultGateway($api);


#### GET request:

$api->delete($staff->getPerson()); // assuming that you are deleting your newly created staff record

$query = new \Arbor\Query\Query(Arbor\Resource\ResourceType::ARBOR_MODEL);
$query->addPropertyFilter(ArborModel::PROPERTY_NAME, OPERATOR, $value);
$query->addPropertyFilter(ArborModel::PROPERTY_NAME, SECOND_OPERATOR, $value);
... 

$records = \Arbor\Model\ArborModel::query($query); // will return an array of records

foreach ($records as $record) {
    // e.g. $record->getDisplayName();
}