-
-
Notifications
You must be signed in to change notification settings - Fork 50
Home
Open-source PHP library for integrating with SATUSEHAT — Indonesia's national health data platform powered by FHIR R4.
satusehat-integration is an open-source PHP library for integrating with SATUSEHAT — Indonesia's national health data platform powered by FHIR R4.
Built on the official SATUSEHAT Platform Guidelines. Ships with:
- 32 DataType classes — composable FHIR R4 value objects
- 112 PayloadBuilder classes — fluent builders for all FHIR R4 resources
- SSRequest / SSResponse — HTTP client with OAuth2 + retry
- Durable queue + worker — SQLite-backed, retry/DLQ, rate limiting, monitoring
- SSValidationError — maps SATUSEHAT validation rule codes to human messages
- Master data: ICD-10, Kode Wilayah Indonesia, KFA v2
Works standalone (native PHP 7.4+) or integrated with Laravel via the service provider.
composer require ivanwilliammd/satusehat-integration# .env
SATUSEHAT_ENV=DEV
SATUSEHAT_BASE_URL_DEV=https://api-satusehat-dev.dto.kemkes.go.id
CLIENTID_DEV=your_client_id
CLIENTSECRET_DEV=your_client_secret
ORGID_DEV=your_org_iduse Satusehat\Integration\SSRequest\SSRequest;
use Satusehat\Integration\OAuth2Client;
use Satusehat\Integration\DataType\Identifier;
use Satusehat\Integration\DataType\HumanName;
use Satusehat\Integration\DataType\Address;
use Satusehat\Integration\DataType\ContactPoint;
use Satusehat\Integration\Builder\PayloadBuilderPatient;
$ss = new SSRequest(new OAuth2Client());
$patient = (new PayloadBuilderPatient)
->addIdentifier(new Identifier(
system: 'https://fhir.kemkes.go.id/id/NIK',
value: '3312345678901234'
))
->addName(new HumanName(
family: 'Doe',
given: ['John', 'Michael'],
use: 'official'
))
->addTelecom(new ContactPoint(
system: 'phone',
value: '081234567890',
use: 'mobile'
))
->addAddress(new Address(
use: 'home',
line: ['Jl. Sudirman No.1'],
city: 'Jakarta Selatan',
district: 'Kebayoran Baru',
state: 'DKI Jakarta',
postalCode: '12190',
country: 'ID'
))
->setGender('male')
->setBirthDate('1990-01-15')
->setActive(true)
->build();
$resp = $ss->post('Patient', $patient);
if ($resp->isSuccess()) {
$patientId = $resp->getResourceId();
echo "Patient created: $patientId\n";
} else {
foreach ($resp->getErrorMessages() as $msg) {
echo "Error: $msg\n";
}
}Atomic FHIR R4 value objects. All extend DataType which provides a recursive toArray() method — nested DataType instances serialize to clean FHIR JSON automatically.
| Category | Classes |
|---|---|
| Core |
Coding, CodeableConcept, Identifier, Period, ContactPoint, Address, HumanName, Reference
|
| Quantity |
Quantity, SimpleQuantity, Range, Ratio, Age, Count, Distance, Duration, Money
|
| Structured |
Attachment, Narrative, Annotation, Timing, TimingRepeat, Dosage, DosageDoseAndRate
|
| Utility |
Extension, Signature, RelatedArtifact, Expression, TriggerDefinition, DataRequirement, ParameterDefinition
|
Fluent builder for each FHIR resource. Each builder accepts DataType instances and exposes a build() method returning a clean FHIR JSON payload.
All 112 PayloadBuilder classes cover the complete FHIR R4 resource space.
-
SSRequest — HTTP client with
get(),post(),put(),delete(),patch()methods. Handles OAuth2 bearer tokens, auto-refresh on HTTP 401, retry with exponential backoff on 429/5xx, configurable timeout. -
SSResponse — Structured response wrapper:
isSuccess()/isError(),getErrorMessages(),getResourceId().
Durable SQLite queue with background worker. Handles retry, DLQ, rate limiting, and monitoring. Works standalone (no Laravel needed).
| Environment | Base URL |
|---|---|
| DEV | https://api-satusehat-dev.dto.kemkes.go.id |
| STG | https://api-satusehat-stg.dto.kemkes.go.id |
| PROD | https://api-satusehat.kemkes.go.id |