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);
use Arbor\Api\Gateway\UploadFile;
$fileContent = file_get_contents('/path/to/document.pdf');
$response = $api->upload(
'/rest-v2/documents/upload',
new UploadFile(name: 'file', contents: $fileContent, filename: 'document.pdf')
);
// $streamFactory can be any PSR-17 StreamFactoryInterface implementation
$stream = $streamFactory->createStreamFromFile('/path/to/large-video.mp4');
$response = $api->upload(
'/rest-v2/documents/upload',
new UploadFile(name: 'file', contents: $stream, filename: 'large-video.mp4')
);
$student = \Arbor\Model\Student::retrieve(16);
$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();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.