2017 © Pedro Peláez
 

library config

Config variables access by globally anywhere

image

ajmerainfo/config

Config variables access by globally anywhere

  • Sunday, October 18, 2015
  • by ajmerainfo
  • Repository
  • 1 Watchers
  • 1 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

# PHP Config

.config: config file reader and use anywhere in environment. Very simple user configuration settings anywhere in project., (*1)

Requirements

  • PHP 5.3+

Installation

[Using Composer], (*2)

Run composer require ajmerainfo/config, (*3)

Or add the plugin to your project's composer.json - something like this:, (*4)

  {
    "require": {
      "ajmerainfo/config": "dev-master"
    }
  }

Usage

Create a new loader from begining request:, (*5)

<?php
// Don't forget to load autoload composer file.
// require __DIR__ . '/vendor/autoload.php'; 

// Optional you can pass file name by second parameters
Config::init(__DIR__, '.myconfig');
// no need to init function call if file name is .config and located on root of project

After load file you can call direct config parameter like following code, (*6)

// .config file on root

# Database Information
-----------------------
DB_NAME=test_database
DB_USERNAME=root
DB_PASSWORD=

# Payment Information
API_KEY=sdfds6549sdf7SDFD@#$55

You can call variable like below in PHP code, (*7)

<?php

echo Config::get('DB_NAME');
// output: test_database

echo Config::get('API_KEY');
// output: sdfds6549sdf7SDFD@#$55

// With under any namespace
echo \Config::get('API_KEY');

// call other way from anywhere
getConfig('API_KEY');
getConfig('API_KEY', 'DEFAULT VALUE IF NOT FOUND');

echo Config::get('DUMMY', 'Default Value');
// output: Default Value
// Get default value if key not found in config file

You can use comment by start with hash# or dash- sign., (*8)


Let me know if any issue or any feature require., (*9)


The Versions

18/10 2015

dev-master

9999999-dev http://github.com/ajmerainfo/config

Config variables access by globally anywhere

  Sources   Download

BSD

The Requires

  • php >=5.3.2

 

config ajmerainfo

18/10 2015

1.0.5

1.0.5.0 http://github.com/ajmerainfo/config

Config variables access by globally anywhere

  Sources   Download

BSD

The Requires

  • php >=5.3.2

 

config ajmerainfo

16/10 2015

1.0.4

1.0.4.0 http://github.com/ajmerainfo/config

Config variables access by globally anywhere

  Sources   Download

BSD

The Requires

  • php >=5.3.2

 

config ajmerainfo

16/10 2015

1.0.3

1.0.3.0 http://github.com/ajmerainfo/config

Config variables access by globally anywhere

  Sources   Download

BSD

The Requires

  • php >=5.3.2

 

config ajmerainfo

13/10 2015

1.0.2

1.0.2.0 http://github.com/ajmerainfo/config

Config variables access by globally anywhere

  Sources   Download

BSD

The Requires

  • php >=5.3.2

 

config ajmerainfo

13/10 2015

1.0.1

1.0.1.0 http://github.com/ajmerainfo/config

Read config file and load config variable from .config by $_CONFIG

  Sources   Download

BSD

The Requires

  • php >=5.3.2

 

config ajmerainfo

13/10 2015

1.0.0

1.0.0.0 http://github.com/ajmerainfo/config

Read config file and load config variable from .config by $_CONFIG

  Sources   Download

BSD

The Requires

  • php >=5.3.2

 

config ajmerainfo

13/10 2015

0.0.1-alpha

0.0.1.0-alpha http://github.com/ajmerainfo/config

Read config file and load config variable from .config by $_CONFIG

  Sources   Download

BSD

The Requires

  • php >=5.3.2

 

config ajmerainfo

13/10 2015

v1.0.0-BETA

1.0.0.0-beta http://github.com/ajmerainfo/config

Read config file and load config variable from .config by $_CONFIG

  Sources   Download

BSD

The Requires

  • php >=5.3.2

 

config ajmerainfo