PHPackages                             dcarbone/php-fhir-generated - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dcarbone/php-fhir-generated

ActiveLibrary[API Development](/categories/api)

dcarbone/php-fhir-generated
===========================

Pre-generated classes from dcarbone/php-fhir

v4.1.1(2w ago)45515.8k↓31%10[1 issues](https://github.com/dcarbone/php-fhir-generated/issues)1Apache-2.0PHPPHP ^8.1CI failing

Since Feb 10Pushed 2w ago3 watchersCompare

[ Source](https://github.com/dcarbone/php-fhir-generated)[ Packagist](https://packagist.org/packages/dcarbone/php-fhir-generated)[ Docs](https://github.com/dcarbone/php-fhir-generated)[ GitHub Sponsors](https://github.com/dcarbone)[ Fund](https://ko-fi.com/dcarbone)[ RSS](/packages/dcarbone-php-fhir-generated/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (3)Versions (39)Used By (1)

php-fhir-generated
==================

[](#php-fhir-generated)

[![License](https://camo.githubusercontent.com/798509b4df525f56802b56f8096862487f08023e3d7561c68656f8dab10d0d6e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4170616368652d2d322e302d626c75652e737667)](https://github.com/dcarbone/php-fhir-generated/blob/main/LICENSE)[![PHP Version](https://camo.githubusercontent.com/04744bae0a61d2ffe29c26f07a9612eae20445fc6feaeb77b3af1f0e9be6447c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d3838393242462e737667)](https://www.php.net/)

Pre-generated PHP classes for [HL7 FHIR](https://www.hl7.org/fhir/) resources, produced by [dcarbone/php-fhir](https://github.com/dcarbone/php-fhir).

This library provides strongly-typed PHP models for every FHIR resource, element, and primitive across multiple FHIR versions — complete with JSON/XML serialization, field validation, and a built-in REST client.

Features
--------

[](#features)

- **All major FHIR versions** — DSTU1, DSTU2, STU3, R4, R4B, and R5
- **Strongly-typed models** — every resource, element, and primitive as a PHP class with full constructor support
- **JSON &amp; XML serialization** — encode/decode resources using native PHP extensions
- **Built-in FHIR REST client** — read, create, update, patch, and delete resources via cURL
- **Automatic resource parsing** — detect and unserialize arbitrary FHIR responses by `resourceType` or XML element name
- **Schema-driven validation** — built-in rules derived from the FHIR schema, with support for custom rules
- **PHP 8.1+ named arguments** — clean, readable type construction without positional `null` padding

Supported FHIR Versions
-----------------------

[](#supported-fhir-versions)

VersionFHIR SpecDSTU1v0.xDSTU2v1.xSTU3v3.xR4v4.0R4Bv4.3R5v5.xRequirements
------------

[](#requirements)

- PHP 8.1 or newer
- Extensions: `curl`, `dom`, `json`, `libxml`, `simplexml`, `xmlreader`, `xmlwriter`

Installation
------------

[](#installation)

### Via Composer (recommended)

[](#via-composer-recommended)

```
composer require dcarbone/php-fhir-generated
```

### Standalone

[](#standalone)

Clone or download this repository and require the built-in autoloader:

```
require __DIR__ . '/src/DCarbone/PHPFHIRGenerated/Autoloader.php';
```

Quick Start
-----------

[](#quick-start)

### Constructing a Resource

[](#constructing-a-resource)

```
