Loader: generic data/config loader with advanced features

v1.2.1 2019-11-25 13:12 UTC

This package is auto-updated.

Last update: 2022-11-25 19:52:08 UTC


Generic data/config loader with advanced features


$loader = Loader::create();
$data = $loader->load('my.yaml');


File formats:

  • JSON
  • JSON5 (comments, trailing commas, etc)
  • YAML

JSON References ($ref)

You can use json references in any of the supported file formats (json, json5, yaml)


  $ref: example.json5
  $ref: https://example.web/example.json

This will "include" the referenced files as if they were part of the main file.

The file type is determined based on file extension or (in case of remote files) the HTTP response header

Variable interpolation (expressions)

You can reference other variables anywhere in your files:

  color: green
text: My favorite color is {{hello.color}}!

Helper functions

You can use various helper functions inside of the variable blocks.

  • strtoupper
  • strtolower
  • ucfirst
  • array_merge_recursive: recursively merge 2 arrays (can be nested multiple times)
  • dict: turn key/value dictionaries into arrays of key+value items

You can register your own helpers too:

  function ($arguments, $text) {
    // do something with the input arguments and return
    return ucfirst($text);

Variables in references:

You can also use variables in references:

license: MIT
licenseUrl:{{ config.license }}


MIT. Please refer to the license file for details.

Brought to you by the LinkORB Engineering team

Check out our other projects at

Btw, we're hiring!