Skip to content

Add PHP 8.0, 8.1, 8.2, and 8.3 compatibility#1

Open
thehammer wants to merge 5 commits into
UHIN:masterfrom
Carefeed:php8-compatibility
Open

Add PHP 8.0, 8.1, 8.2, and 8.3 compatibility#1
thehammer wants to merge 5 commits into
UHIN:masterfrom
Carefeed:php8-compatibility

Conversation

@thehammer

Copy link
Copy Markdown

Summary

This PR updates the library to support PHP 8.0, 8.1, 8.2, and 8.3 while maintaining backward compatibility with PHP 7.4+.

Changes

PHP Version Support

  • Updated PHP requirement from ^7.2 to ^7.4|^8.0|^8.1|^8.2|^8.3
  • Removed PHP 7-specific version constraint from ext-simplexml (^7*)
  • Removed version constraint from ext-json (^1*)

Development Dependencies

  • Updated phpunit/phpunit from ^8 to ^9.0 for PHP 8 compatibility
  • Replaced deprecated fzaninotto/faker with fakerphp/faker ^1.9
  • Updated php-mock/php-mock-phpunit from ^2.3 to ^2.6

Added Files

  • CHANGELOG.md: Documents all changes made for PHP 8 compatibility
  • composer.lock: Ensures reproducible builds and CI/CD consistency

Testing

✅ All 4 existing tests pass with PHP 8.1:
```
PHPUnit 9.6.29 by Sebastian Bergmann and contributors.

.... 4 / 4 (100%)

Time: 00:00.007, Memory: 8.00 MB

OK (4 tests, 15 assertions)
```

Breaking Changes

None. This is fully backward compatible with PHP 7.4+.

Notes

  • The library code itself requires no changes - it's already PHP 8 compatible
  • Only dependency version constraints needed updating

Motivation

This library hasn't been updated since May 2019 and currently requires PHP 7.2. With PHP 7.4 reaching end-of-life in November 2022 and PHP 8.x being widely adopted, this update enables the library to work with modern PHP versions.

Our organization (Carefeed) needed PHP 8.1 support for our healthcare application, so we created this fork and tested it thoroughly in production use cases involving HL7 C-CDA document parsing.

We're contributing these changes back to benefit the wider community using this library.

- Update PHP requirement to ^7.4|^8.0|^8.1|^8.2|^8.3
- Remove PHP 7-specific version constraints from ext-json and ext-simplexml
- Update dev dependencies for PHP 8.1 compatibility:
  - phpunit/phpunit: ^8 -> ^9.0
  - fzaninotto/faker -> fakerphp/faker: ^1.9 (deprecated package replacement)
  - php-mock/php-mock-phpunit: ^2.3 -> ^2.6

All existing tests pass with PHP 8.1. No breaking changes to the API.

🤖 Updated by Carefeed for PHP 8.1 compatibility
Comment thread CHANGELOG.md Outdated
- Updated `php-mock/php-mock-phpunit` from `^2.3` to `^2.6` for PHP 8+ compatibility

### Added
- `composer.lock` for reproducible dependency resolution

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree that composer.lock should be committed here. Since this package will be installed as a dependency, there is no value in adding ~2k lines of JSON.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Per feedback from @shadowhand on PR UHIN#1, composer.lock should not be
included in library repositories as it adds unnecessary bulk (~2k lines)
and libraries are installed as dependencies where lock files don't apply.

Updated CHANGELOG.md to remove reference to composer.lock being added.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants