Releases: phpgt/Json
April 2026 release
What's Changed
- #62 Error Validation by @pixeldrift64 in #63
- feature: error callback by @g105b in #65
- build(deps-dev): bump phpstan/phpstan from 1.12.19 to 2.1.40 by @dependabot[bot] in #66
- build(deps): bump justinrainbow/json-schema from 6.2.0 to 6.7.2 by @dependabot[bot] in #68
- build(deps-dev): bump phpunit/phpunit from 10.5.45 to 10.5.62 by @dependabot[bot] in #69
- build(deps): bump justinrainbow/json-schema from 6.7.2 to 6.8.0 by @dependabot[bot] in #71
- gt-tidy by @g105b in #72
- tidy: JSON casing by @g105b in #73
- build(deps-dev): bump squizlabs/php_codesniffer from 3.11.3 to 4.0.1 by @dependabot[bot] in #67
New Contributors
- @pixeldrift64 made their first contribution in #63
- @dependabot[bot] made their first contribution in #66
Full Changelog: v2.2.0...v2.2.1
Schema Object & JsonDocumentBuilder
This release mainly focuses on improving type safety, handling complex JSON structures, and extending the functionality of JsonDocument and related classes.
- Add JetBrains sponsorship to README with H1 heading by @g105b in #60
- Schema object and json document builder by @g105b in #61
Full Changelog: v2.1.0...v2.2.0
In JsonKvpObject.php:
- Adjusted validation logic to add support for potential null key in valid() method.
In JsonObjectBuilder.php:
- Enhanced JSON structure validation during decoding.
- Improved handling of complex JSON structures, including proper treatment of scalar values, associative arrays, and indexed arrays.
- Streamlined code by replacing verbose conditional branches with modern match() syntax.
- Introduced helper methods to process arrays and nested elements cleanly.
New File:
- Added JsonTypeException.php to provide specific exception handling for JSON type-related errors.
In JsonDocument.php:
- Added set() and get() methods to support dot notation for accessing and modifying nested keys.
- Refactored code to ensure support for JsonKvpObject transformations while handling nested objects effectively.
- Ensured proper type handling and safe traversal for nested structures with utility methods.
In JsonDocumentTest.php:
- Refactored existing tests and added new tests to validate setObject, set() functionality (including nested keys), and construction of JSON objects from associations.
These improvements aim to make the library more robust, reduce vulnerabilities with incorrect type handling, and improve test coverage for better reliability.
Build JsonObject directly from files
In this release, we introduce the JsonObjectBuilder::fromFile() function that will read the provided file into the appropriate JsonObject type.
Schema validation
In this release, we can now automatically validate JSON objects according to a schema. This feature exists so that WebEngine applications can serve JSON API endpoints with the same effort as HTML pages.
Read the wiki for more information!
July 2023
Internal improvements and more control over json_decode
Throw JsonDecodeException, plus various improvements
v1 release
Following on from the v1 release of PHP.Gt/DataObject earlier today, PHP.Gt/Json is now able to have its first stable release made.
No new functionality has been introduced since the last pre-release, only the upgraded dependency.
Have fun and stay productive!
All JSON compatibility added
It's possible to use all types of JSON object/primitive with this library now. There are more tests required and possibly some extra functionality to add before v1, but for now it will be included in the Fetch repository for real-world testing.