artox-lab/json-config

There is no license information available for the latest version (1.5.1) of this package.

Yet Another JSON config for PHP

1.5.1 2021-01-19 15:56 UTC

This package is not auto-updated.

Last update: 2024-12-18 10:37:04 UTC


README

Installation via Composer

{
    "require": {
        "artox-lab/json-config": "1.3.1"
    }
}

Run composer update

Config Definition

config.json

{
  "name": "Suppa Project",
  "version": 1,
  "rating": 2.5,
  "authors": [
    "code.god@gmail.com"
  ],
  "emails": {
    "subscription": [
      "user1@gmail.com",
      "user2@gmail.com"
    ],
    "user": {
      "name": "Johny"
    },
    "should_notify": true
  }
}

Config Usage

index.php

<?php

include 'vendor/autoload.php';

// Setup path to config file
JsonConfig\Config::setup('config.json');

// Get data from config
$subscriptions = JsonConfig\Config::get('emails.subscription');