PHP implementation of JSON Patch (RFC 6902) and JSON Pointer (RFC 6901) for applying and generating JSON patches.
json-patch-php is a PHP library that implements the IETF JSON Patch (RFC 6902) and JSON Pointer (RFC 6901) specifications. It allows developers to apply patches to JSON documents, generate patches between JSON structures, and reference specific locations within JSON data using standardized operations. The library solves the problem of efficiently modifying and synchronizing JSON data in PHP applications.
PHP developers working with JSON data who need to implement patch-based updates, synchronize JSON documents, or integrate with APIs using JSON Patch standards.
Developers choose json-patch-php because it provides a reliable, standards-compliant implementation of JSON Patch and JSON Pointer in pure PHP, with additional features like SimpleXML mode for handling XML-derived data structures and efficient array-based processing.
PHP implementation of JSON-patch (IETF RFC 6902)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements both JSON Patch (RFC 6902) and JSON Pointer (RFC 6901) fully, ensuring standard-compliant operations for interoperability with other systems.
Includes SimpleXML mode to handle arrays from XML sources, with implicit promotion of scalars to arrays, easing data transformation for real-world use cases.
Processes JSON data as PHP associative arrays directly from json_decode, avoiding object conversion overhead and simplifying integration in array-centric codebases.
Provides JsonPatch::diff to automatically create patches between JSON documents, useful for synchronization and versioning without manual operation crafting.
Requires JSON data as associative arrays, not stdClass objects, which can be inconvenient for object-oriented PHP projects and limits flexibility.
Treats empty arrays and objects as identical, deviating from strict JSON semantics and potentially causing compatibility issues with other implementations.
Not available on Packagist; requires adding a VCS repository to composer.json, increasing installation overhead compared to standard PHP libraries.