Name: php-fhir
Owner: Synappz Medical Apps
Description: Tools for consuming data from a FHIR server with PHP
Forked from: dcarbone/php-fhir
Created: 2016-02-25 15:38:27.0
Updated: 2016-02-25 15:38:28.0
Pushed: 2016-03-10 10:14:13.0
Size: 147
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Tools for consuming data from a FHIR server with PHP
This library requires the use of Composer
Require entry:
"dcarbone/php-fhir": "0.3.*"
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:
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:
ire __DIR__.'/vendor/autoload.php';
Path = 'path to wherever you un-zipped the xsd files';
erator = new \DCarbone\PHPFHIR\ClassGenerator\Generator($xsdPath);
erator->generate();
Using the above code will generate class files under the included output directory, under the namespace
PHPFHIRGenerated
If you wish the files to be placed under a different directory, pass the path in as the 2nd argument in the generator constructor.
If you wish the classes to have a different base namespace, pass the desired NS name in as the 3rd argument in the generator constructor.
There are a plethora of good HTTP clients you can use to get data out of a FHIR server, so I leave that up to you.
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.
ire 'path to PHPFHIRResponseParser.php';
ser = new \\YourConfiguredNamespace\\PHPFHIRResponseParser;
ect = $parser->parse($yourResponseData);
Currently this library is being tested against v0.0.82 and v1.0.2. using the open server available here: http://fhir2.healthintersections.com.au/open/ .
If you have some suggestions for how this lib could be made more useful, more applicable, easier to use, etc, please let me know.