2017 © Pedro Peláez
 

library super-simple-config

A super-simple config parser for small projects

image

pete-robinson/super-simple-config

A super-simple config parser for small projects

  • Thursday, August 31, 2017
  • by peterobinson
  • Repository
  • 1 Watchers
  • 0 Stars
  • 206 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Super-Simple-Config

Introduction

A super-simple configuration manager that enables easy integration with YAML based configuration files., (*1)

Pass in the configuration YAML file location and the class will parse it and make its properties avaialble to you, with dot separated levels of nesting, (*2)

Usage

Create a new instance of the config class and load in the config, (*3)

Example YAML Config File

config:
  database:
    host: 127.0.0.1
    user: username
    password: password
    name: db_name
  api:
    google:
      client_id: myclientid
      key: xxxxxxxxx

Create a New Config Instance

<?php
$file = realpath(__DIR__ . '/path/to/file.yml');
$config = new Config($file);

Fetch Config Parameters

<?php
echo $config->get('path.to.parameter');

Example Based on Config File Above

<?php
echo $config->get('config.database.host');
// returns 127.0.0.1

echo $config->get('config.api.google.client_id');
// returns 'myclientid'

The Versions

31/08 2017

dev-master

9999999-dev

A super-simple config parser for small projects

  Sources   Download

MIT

The Requires