Skip to content

Used to read key/value pairs from a flat JSON file. Used to read Vault secrets.

Notifications You must be signed in to change notification settings

MedBridge/json-reader-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-reader-php

Easily read key/value pairs from a flat JSON file.

Installation

Update composer.json to include the following and then run composer update

{
  "require": {
    "medbridge/json-reader-php": "master@dev"
  },
  "repositories": [{
    "type": "vcs",
    "url": "[email protected]:MedBridge/json-reader-php.git"
  }]
}

Example implementation

class Vault
{

    const secretPath = "/path/to/json.json";
    const readerName = "myjson";

    public static function read($secret)
    {
        /** @var JsonReader\Reader $reader */
        $reader = JsonReader\ReaderRegistry::getOrRegisterReader(self::readerName, self::secretPath);
        return $reader->read($secret);
    }

}

About

Used to read key/value pairs from a flat JSON file. Used to read Vault secrets.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages