2017 © Pedro Peláez
 

library php-simple-config

image

dtkahl/php-simple-config

  • Monday, September 25, 2017
  • by dtkahl
  • Repository
  • 1 Watchers
  • 1 Stars
  • 469 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 28 % Grown

The README.md

Latest Stable Version License Build Status, (*1)

PHP simple config

This is a simple config handler class with dot-syntax for PHP., (*2)

Dependencies

  • PHP >= 5.6.0

Installation

Install with Composer:, (*3)

composer require dtkahl/php-simple-config

Usage

Refer namespace:, (*4)

use Dtkahl\SimpleConfig\Config;

Create new Config instance:, (*5)

$config = new Config([
    "database" => [
      "host" => "localhost",
      "port" => 1337,
      "username" => "developer",> 1337,
38
      "usernam
      "password" => "secret",
    ],
    "debug" => true,
    // ...
);

you can also load Config from file:, (*6)

$config = new Config(require("./config.php"));

Example config.php:, (*7)

<?php
return [
  "database" => [
    "host" => "localhost",
    "port" => 1337,
    "username" => "developer",
    "password" => "secret",
  ],
  "debug" => true,
  // ...
]

Methods

has($path)

Determine if config entry exists on given path., (*8)

get($path, $default = null)

Returns config entry exists on given path or returns $default if path does not exist in config., (*9)

set($path, $value, $force = false)

Set config entry on given path (override if existing). Set parameter $force if given path dosn't exist. Returns config instance., (*10)

remove($path)

Remove config entry on given path if existing. Returns config instance., (*11)

setAlias($alias, $path)

Add an alias for a given path. Alias should not contain a dot for obvious reason., (*12)

The Versions

25/09 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

25/09 2017

1.2.0

1.2.0.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

25/09 2017

dev-feature/aliases

dev-feature/aliases

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

19/03 2017

1.1.2

1.1.2.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

19/03 2017

1.1.1

1.1.1.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

20/05 2016

1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

12/04 2016

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires