PHPackages                             pharmaintelligence/mllp - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pharmaintelligence/mllp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pharmaintelligence/mllp
=======================

PHP MLLP Server &amp; Client. Based on ReaktPHP.

987.6k↑31.3%3PHP

Since Jan 25Pushed 11y ago1 watchersCompare

[ Source](https://github.com/Pharma-Intelligence/MLLP)[ Packagist](https://packagist.org/packages/pharmaintelligence/mllp)[ RSS](/packages/pharmaintelligence-mllp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MLLP
====

[](#mllp)

MLLP Server implementation in PHP built on [reactphp](http://reactphp.org/). The MLLP Server listens to a TCP port. Accepts MLLP payloads, handles the unwrapping of the MLLP envelope and wrapping or the response.

Server
------

[](#server)

This distribution contains one abstract `Server` class that can be used to build upon and emits 4 events. Responses to clients should be send through the `send()` function.

Events
------

[](#events)

1. `connection` : When a connection is made this event is emitted. Argument is the connection. Instance of `ConnectionInterface`
2. `data`: When data is received this event is emitted. Event contains two arguments: `$data` the data received, stripped from it's MLLP envelope, and the connection which received the data, instance of `ConnectionInterface`
3. `send`: When data is sent through the server this event is emitted. Event contains the unwrapped data.
4. `error`: Whenever an error occurs on receiving data, unwrapping the MLLP envelope, or sending the data this event is emitted. Contains one argument: `$errorMessage`

Example implementation
----------------------

[](#example-implementation)

```

use PharmaIntelligence\MLLP\Server;
use PharmaIntelligence\HL7\Unserializer;
use React\Socket\ConnectionInterface;

class MyServer extends Server {
    // No added logic in this example
}

$loop = React\EventLoop\Factory::create();
$socket = new React\Socket\Server($loop);
// Set up a React stream to STDOUT to log everything to the console.
$logging = new React\Stream\Stream(STDOUT, $loop);
$server = new MyServer($socket);

// Log connection info
$server->on('connection', function(ConnectionInterface $connection) use($logging) {
    $logging->write('Connection from: '.$connection->getRemoteAddress().PHP_EOL);
});

// Log error info
$server->on('error', function($errorMessage) use($logging)  {
    $logging->write('Error: '.$errorMessage.PHP_EOL);
});

// Log sent data
$server->on('send', function($data) use($logging)  {
    $logging->write('Sending: '.str_replace(chr(13), PHP_EOL, $data).PHP_EOL);
});

// Log received data
$server->on('data', function($data) use($logging)  {
    $logging->write('Received: '.str_replace(chr(13), PHP_EOL, $data).PHP_EOL);
});
$server->on('data', function ($data, ConnectionInterface $connection) use($server) {
    // $data contains a HL7 Payload
    // Parse HL7 and create an ACK message
    $ack = 'AN_ACK_STRING';
    $server->send($ack, $connection);
    $connection->end();
});
$socket->listen(23887);

$loop->run();

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a79128a0c74074f04ae42427d85df6dad604565731a59d86b9a4bd6e8199e5f?d=identicon)[linde002](/maintainers/linde002)

---

Top Contributors

[![linde002](https://avatars.githubusercontent.com/u/3629616?v=4)](https://github.com/linde002 "linde002 (1 commits)")

### Embed Badge

![Health badge](/badges/pharmaintelligence-mllp/health.svg)

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

PHPackages © 2026

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