1. Go to this page and download the library: Download clinically/laravel-halaxy 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/ */
clinically / laravel-halaxy example snippets
use Clinically\Halaxy\DTOs\ContactPoint;
use Clinically\Halaxy\DTOs\PatientPayload;
use Clinically\Halaxy\Facades\Halaxy;
// Find, list, create
$patient = Halaxy::patients()->find('123456')->json();
$bundle = Halaxy::patients()->list(['_count' => 30]);
$payload = new PatientPayload(
name: [['use' => 'official', 'given' => ['John'], 'family' => 'Doe']],
telecom: [
ContactPoint::mobile('+61400000000'),
ContactPoint::email('[email protected]'),
],
birthDate: '1990-01-15',
);
$created = Halaxy::patients()->create($payload);
// Partial update (JSON merge-patch)
Halaxy::patients()->update('123456', $payload);
// Full replace (PUT) — destructive: writable properties omitted from the
// payload are REMOVED from the profile (only file attachments survive).
// Always send the complete desired state.
Halaxy::patients()->replace('123456', $payload);
// Raw arrays remain supported for backwards compatibility, but typed contact
// points enforce Halaxy's
$paginator = Halaxy::patients()
->query()
->where('family', 'Doe')
->where('_lastUpdated', 'gt', '2024-01-01')
->orderBy('family')
->paginate(50);
foreach ($paginator->items() as $patient) {
// current page
}
foreach ($paginator->all() as $patient) {
// lazily fetches every page
}
// e.g. routes/tenant-webhooks.php, grouped under {tenant} + tenant middleware
use Clinically\Halaxy\Webhooks\HalaxyWebhookRoutes;
HalaxyWebhookRoutes::register('halaxy');
use Clinically\Halaxy\Exceptions\AuthenticationException;
use Clinically\Halaxy\Exceptions\MethodNotAllowedException;
use Clinically\Halaxy\Exceptions\NotFoundException;
use Clinically\Halaxy\Exceptions\RateLimitException;
use Clinically\Halaxy\Exceptions\ServerException;
use Clinically\Halaxy\Exceptions\ValidationException;
try {
$response = Halaxy::patients()->find('invalid-id');
} catch (NotFoundException $e) {
// 404
} catch (MethodNotAllowedException $e) {
// 405 — the resource does not support this interaction at all
} catch (ValidationException $e) {
// 400/422 — $e->operationOutcome holds the FHIR OperationOutcome issues
} catch (AuthenticationException $e) {
// 401/403 — message