Skip to content
/ HPRIM Public
forked from senaranya/HL7

PHP library for Parsing and generate HPRIM Message

License

Notifications You must be signed in to change notification settings

Akarah/HPRIM

 
 

Repository files navigation

Build Status Total Downloads Latest Stable Version License

Important: Supported PHP version has been updated to 7.3+. Last supported versions: for PHP 7.2 => 2.0.2, for PHP 7.0 or 7.1 => 1.5.4

Introduction

A PHP-based HPRIM v2.x Parsing and Generating library, inspired by Net-HL7 package (perl).

Installation

composer require Akarah/hprim

Usage

Import library

// First, import classes from the library as needed...
use Akarah\HPRIM\Message;
use Akarah\HPRIM\Segment;
use Akarah\HPRIM\Segments\H;
use Akarah\HPRIM\Segments\P;

Parsing

// Create a Message object from a HL7 string
$msg = new Message("MSH|^~\\&|1|\rPID|||abcd|\r"); // Either \n or \r can be used as segment endings
$P = $msg->getSegmentByIndex(1);
echo $pid->getField(3); // prints 'John'
echo $msg->toString(true); // Prints entire HPRIM string

// Get the first segment
$msg->getFirstSegmentInstance('H'); // Returns the first PID segment. Same as $msg->getSegmentsByName('PID')[0];

// Check if a segment is present in the message object
$msg->hasSegment('P'); // return true or false based on whether PID is present in the $msg object

// Check if a message is empty
$msg = new Message();
$msg->isempty(); // Returns true

Creating new messages

// Create an empty Message object, and populate H and P segments... 

Other

Visit docs\README for details on available APIs

  • All HPRIM message beginning with H segment
  • All HPIM message have L segment at end

About

PHP library for Parsing and generate HPRIM Message

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%