Skip to content

Breaking changes, improved message handling, requires PHP 8.2+

Choose a tag to compare

@senaranya senaranya released this 16 Mar 13:16
· 6 commits to master since this release
aaae2d8

⚠️ Breaking Release

Version 4.0 introduces several breaking changes and now requires PHP 8.2 or newer.

If you are upgrading from 3.x, please review the upgrade guide before updating:

➡️ https://github.com/senaranya/HL7/blob/master/UPGRADE.md

Breaking changes

  • Minimum supported PHP version is now 8.2
  • The first segment in a Message object must be MSH
  • In insertSegment() method, only MSH can be inserted now in the 0th index
  • InvalidArgumentException has been replaced with HL7Exception
  • withSegmentSeparator() only accepts CRLF (\r\n) as a multi-character separator

Deprecations

  • Direct instantiation of Message is deprecated. Use the HL7 factory instead, e.g. $message = HL7::build()->create()
  • setSegment() is deprecated in favor of insertSegment()
  • Global setting SEGMENT_ENDING_BAR is deprecated (use WITH_SEGMENT_ENDING_FIELD_SEPARATOR)

New features

  • insertSegment() now has an optional replace parameter
  • New replaceSegment() method
  • HL7::create() added as an alias of createMessage()

Other updates

  • PHPUnit upgraded to v11
  • Dependencies updated
  • Documentation and tests improved
  • Internal code cleanup and refactoring

Upgrade

Update via Composer: composer require aranyasen/hl7:^4.0
Then follow the instructions in UPGRADE.md.

Feedback

If you encounter issues or have suggestions:

  • Issues: github.com/senaranya/HL7/issues
  • Pull Requests: github.com/senaranya/HL7/pulls