2017 © Pedro Peláez
 

library settings

A settings abstraction.

image

jaeger-app/settings

A settings abstraction.

  • Saturday, July 9, 2016
  • by mithra62
  • Repository
  • 1 Watchers
  • 0 Stars
  • 342 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Jaeger Settings

Build Status Scrutinizer Code Quality Author GitHub license, (*1)

Jaeger Settings is an abstract object to manage storage of your plugin settings., (*2)

Note that you're NOT meant to instantiate this object; you have to extend it and apply your specific settings before you can get started., (*3)

Installation

Add jaeger-app/settings as a requirement to your composer.json:, (*4)

$ composer require jaeger-app/settings

Once that's done, you'll have to install the database schema located at data\settings_table.sql, (*5)

Simple Example

In your parent object, ensure you extend have 2 properties, $table and $_defaults. $table should be the name of your settings table, and $_defaults is a key => value array of your plugin's settings and a default value for each., (*6)

You'll also have to define a method named validate(array $data, array $extra = array()) that accepts the settings data and returns an array of errors on failure., (*7)

class MyPluginSettings extends \JaegerApp\Settings
{
    /**
     * The name of the settings storage table
     * 
     * @var string
     */
    protected $table = 'my_plugin_settings';

    /**
     * The accepted settings with a default value
     * 
     * @var array
     */
    protected $_defaults = array(
        'key1' => 'value1',
        'key2' => 'value2',
    );

    public function __construct($db, $lang)
    {
        parent::__construct($db, $lang);
        $this->setTable($this->table);
        $this->setTable($this->table);
    }

    public function validate(array $data, array $extra = array())
    {}
}

Advanced Usage

JaegerApp\Settings includes the following capabilities:, (*8)

  1. Configuration Overrides
  2. Encrypting data on storage
  3. Convert new line strings into arrays
  4. Allow for custom values
  5. Serialize arrays on storage

The Versions

09/07 2016

dev-master

9999999-dev

A settings abstraction.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eric Lamb

05/07 2016

0.1.2

0.1.2.0

A settings abstraction.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eric Lamb

05/07 2016

0.1.1

0.1.1.0

A settings abstraction.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eric Lamb

21/04 2016

0.1

0.1.0.0

A settings abstraction.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eric Lamb