Download the PHP package dcarbone/php-fhir without Composer

On this page you can find all versions of the php package dcarbone/php-fhir. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-fhir

php-fhir

Tools for creating PHP classes from the HL7 FHIR Specification

If you're looking to use the classes generated by this library, you may want the php-fhir-generated repo instead.

Install as Standalone Generator

If you wish to use this package as a standalone generator:

  1. Check out the desired branch or tag
  2. Execute composer install from root of project directory
  3. Execute ./bin/generate.sh
  4. Answer all prompts
    • If no custom configuration file is defined, definitions will be downloaded to ./input and classes will be generated under ./output
    • You can execute ./bin/generate.sh --help for details on how to utilize this script
    • You can configure various aspects of this script by altering the values in ./bin/config.php

This script will download configured major versions of FHIR into the input folder and generate classes for every version in the output folder.

Install as Library

If you wish to use the generator as part of a project, you can include it as a composer dependency:

From there, you can reference the Example block for a quick example on how to configure and execute the generator.

Version Table

PHPFHIR Version PHP Versions FHIR Versions
v2 5.4-7.4 DSTU1, DSTU2, STU3, R4 (<v4.3.0)
v3 8.1+ DSTU1, DSTU2, STU3, R4, R5

Basic Usage

The first step is to determine the version of the FHIR spec your implementation supports. Once done, download the appropriate class definition XSDs from http://hl7.org/fhir/directory.html.

Uncompress the XSD's and place them in a directory that is readable by PHP's runtime user.

Next comes the fun:

Class Generation

The class generator utility included with this library is designed to parse the XSD's provided by the FHIR group into PHP classes, complete with markup and type hinting.

There are 2 important things to note with this section:

  1. Your exact implementation will probably vary, don't hesitate to ask if you need some help
  2. The class generation should be run ONCE per FHIR version. Once the classes have been generated they should only ever be re-generated if your server switches to a new FHIR spec

Generation Example

You can view an example config array here: bin/config.php.

Data Querying

Currently only a very simple client intended for debugging use is generated. A future goal is to generate a more fully-featured client.

Response Parsing

As part of the class generation above, a response parsing class called PHPFHIRResponseParser will be created and added into the root namespace directory. It currently supports JSON and XML response types.

The parser class takes a single optional boolean argument that will determine if it should attempt to load up the generated Autoloader class. By default it will do so, but you are free to configure your own autoloader and not use the generated one if you wish.

Parsing Example

Serialization

JSON Serialization

XML Serialization

XML Serialization utilizes XMLWriter.

Testing

As part of class generation, a directory & namespace called PHPFHIRTests is created under the root namespace and output directory.

TODO

Suggestions and help

If you have some suggestions for how this lib could be made more useful, more applicable, easier to use, etc, please let me know.


All versions of php-fhir with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-ctype Version *
ext-curl Version *
ext-json Version *
ext-libxml Version *
ext-simplexml Version *
psr/log Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dcarbone/php-fhir contains the following files

Loading the files please wait ....