A library for working with JSON References

1.1.1 2017-11-23 22:05 UTC

This package is not auto-updated.

Last update: 2021-10-16 12:33:18 UTC


Software License Build Status Coverage Status Quality Score Documentation


This was forked from the referencer written by The PHP League.

Our only change is to support "psuedo-relative" paths.


{ "$ref": "file://./address.json" }

The psuedo-relative paths are resolved relative to a defined root directory.

That root directory is defined by the AR_JSON_SCHEMA_DIR ENV variable. If that is NOT defined the code uses a schema directory relative to the current working directory as the root.

The Basics

Most JSON schemas use JSON references to minimize duplication. A JSON reference is an object that looks like {"$ref": "http://some/where"} and points to a JSON object somewhere else.

JSON Reference is a library for resolving references.

  • Resolves all references, replacing them with proxy objects.
  • Supports references to external files, urls, or custom sources.
  • Safely resolves circular references.
  • Supports caching dereferenced schemas.
  • Dereferenced schemas can be safely json_encoded.
  • Works with Swagger, JSON Schema, and any other spec compliant JSON documents.


Via Composer

composer require activerules/json-reference


Our changes shouldn't change the behavior of the dereferenced files so all of the original documentation should be applicable.

Complete documentation is available here.

Change log

Please see CHANGELOG for more information about what has changed recently.


$ composer test-server
$ composer test


The benchmarks require a local redis server to be running on localhost at the default port.

$ composer bench


Please see CONTRIBUTING for details.


If you discover any security related issues, please email instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.

Sponsored By: