2017 © Pedro Peláez
 

library settings

image

edwinhoksberg/settings

  • Monday, July 11, 2016
  • by EdwinHoksberg
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Settings

A very simple library for managing application settings with the so-called dot notation. Mostly used by my personal projects., (*1)

Travis Coveralls, (*2)

Installation

With composer

Execute this command in your terminal:, (*3)

composer require edwinhoksberg/settings

Or add this line to your composer.json require section:, (*4)

"edwinhoksberg/settings": "~1.0"

And run composer update, (*5)

Without composer

Just require the Settings.php file in your project:, (*6)

require 'src/Settings.php';

How to use

// settings.php should just be a return statement with an array.
// See tests/fixtures/settings.php for an example.
Settings::loadFromFile('settings.php');

// Load from an array
Settings::loadFromArray([ 'settings' => ... ]);

// Get a setting value using dot notation
Settings::get('database.username', 'defaultuser');

// Retrieve the entire settings array
Settings::getAll();

// You can also set/replace settings with dot notation
Settings::set('database.password', 'toor');

// Check if a setting value exists
Settings::has('database.password'); // Returns true or false

// Remove all settings
Settings::clear();

Tests

The test files are located in the tests directory, and can be run with phpunit:, (*7)

phpunit -c phpunit.dist.xml

The Versions

11/07 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >= 7.0.0

 

The Development Requires

11/07 2016

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

  • php >= 7.0.0

 

The Development Requires

11/07 2016

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

  • php >= 7.0.0

 

The Development Requires

11/07 2016

1.0

1.0.0.0

  Sources   Download

MIT

The Requires

  • php >= 7.0.0

 

The Development Requires