PHPackages                             akarah/hprim - 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. akarah/hprim

ActiveLibrary

akarah/hprim
============

HPRIM parser and generator .

2.0.5(5y ago)1221MITPHPPHP &gt;=7.3

Since Nov 16Pushed 5y agoCompare

[ Source](https://github.com/Akarah/HPRIM)[ Packagist](https://packagist.org/packages/akarah/hprim)[ RSS](/packages/akarah-hprim/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (2)Versions (39)Used By (0)

[![Build Status](https://camo.githubusercontent.com/b0f871e3da3a20d4baaecd3c37ea9e530ba6e1d463195e5676c2cfc1e319bc55/68747470733a2f2f7472617669732d63692e6f72672f73656e6172616e79612f484c372e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/senaranya/HL7)[![Total Downloads](https://camo.githubusercontent.com/3eb9683476627852ed8b9f029ccb06055146e23a81052d10451dca51fecd96aa/68747470733a2f2f706f7365722e707567782e6f72672f416b617261682f686c372f646f776e6c6f616473)](https://packagist.org/packages/Akarah/hl7)[![Latest Stable Version](https://camo.githubusercontent.com/6273384549b5dcdb3bd9bc5b6cf4cb79899a25bf8be5dcae86c234b2d9e1d87a/68747470733a2f2f706f7365722e707567782e6f72672f416b617261682f686c372f762f737461626c65)](https://packagist.org/packages/Akarah/hl7)[![License](https://camo.githubusercontent.com/283255fc0d6a743c3e5cd78499498fe68d1007e97ab94a78903a7a9e015d65d5/68747470733a2f2f706f7365722e707567782e6f72672f416b617261682f686c372f6c6963656e7365)](https://packagist.org/packages/Akarah/hl7)

**Important: Supported PHP version has been updated to 7.3+. Last supported versions: for PHP 7.2 =&gt; [2.0.2](https://github.com/senaranya/HL7/tree/2.0.2), for PHP 7.0 or 7.1 =&gt; [1.5.4](https://github.com/senaranya/HL7/tree/1.5.4)**

Introduction
------------

[](#introduction)

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

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

[](#installation)

```
composer require Akarah/hprim
```

Usage
-----

[](#usage)

### Import library

[](#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

[](#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

[](#creating-new-messages)

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

### Other

[](#other)

Visit [docs\\README](docs/README.md) for details on available APIs

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~33 days

Recently: every ~41 days

Total

38

Last Release

1848d ago

Major Versions

1.10.1 → 2.0.02020-09-12

PHP version history (3 changes)1.0.0PHP &gt;=7.1

1.6.0PHP &gt;=7.2

2.0.3PHP &gt;=7.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40168018?v=4)[Akarah](/maintainers/akarah)[@Akarah](https://github.com/Akarah)

---

Top Contributors

[![senaranya](https://avatars.githubusercontent.com/u/5471894?v=4)](https://github.com/senaranya "senaranya (45 commits)")[![DurandSacha](https://avatars.githubusercontent.com/u/29280692?v=4)](https://github.com/DurandSacha "DurandSacha (18 commits)")[![isangil](https://avatars.githubusercontent.com/u/403087?v=4)](https://github.com/isangil "isangil (2 commits)")[![ajibarra](https://avatars.githubusercontent.com/u/794722?v=4)](https://github.com/ajibarra "ajibarra (2 commits)")[![maxence-machu](https://avatars.githubusercontent.com/u/23130568?v=4)](https://github.com/maxence-machu "maxence-machu (1 commits)")[![mmonahanfl](https://avatars.githubusercontent.com/u/36053511?v=4)](https://github.com/mmonahanfl "mmonahanfl (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![samuel-chane](https://avatars.githubusercontent.com/u/47699407?v=4)](https://github.com/samuel-chane "samuel-chane (1 commits)")[![silvioq](https://avatars.githubusercontent.com/u/155036?v=4)](https://github.com/silvioq "silvioq (1 commits)")[![arnowelzel](https://avatars.githubusercontent.com/u/6613614?v=4)](https://github.com/arnowelzel "arnowelzel (1 commits)")[![DamienHarper](https://avatars.githubusercontent.com/u/2448660?v=4)](https://github.com/DamienHarper "DamienHarper (1 commits)")[![lampi87](https://avatars.githubusercontent.com/u/3034138?v=4)](https://github.com/lampi87 "lampi87 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/akarah-hprim/health.svg)

```
[![Health](https://phpackages.com/badges/akarah-hprim/health.svg)](https://phpackages.com/packages/akarah-hprim)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
