PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Kjell-Inge Gustafsson  >  PHP Key Value Pair Object  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Key Value Pair Object
Manage collections of key-value pairs
Author: By
Last change: 1.3
Date: 10 months ago
Size: 3,310 bytes
 

Contents

Class file image Download

KeyValueMgr

> Manages collection of key/value pairs like system config etc

USAGE

<?php
namespace Kigkonsult\KeyValueMgr;

// set up some config

$key   = 'key';
$value = 'value;
$configDataArray = [ $key => $value ];

// set up KeyValueMgr

$cfgMgr = new KeyValueMgr();
$cfgMgr->set( $configDataArray );
$cfgMgr->set( 'key2', 'value2' );

// usage exists / get / remove

if( $cfgMgr->exists( $key ) {
   $value = $cfgMgr->get( $key );
}
$cfgMgr->remove( $key )

Methods

* configDataArray array 

  • configDataArray array
  • static
  • return KeyValueMgr
* configDataArray  array
* static
* return singleton KeyValueMgr
<br><br>


  • return bool true on found
* return bool true on found and value NOT is ```null, '' or []```
<br><br>

  • return array *( key => value )
* return value for key, false on not found

  • return array *( key ) <br><br>
* insert key/value-pair (overwrite if key exists)
* key    string|int 
* value  mixed 
* return KeyValueMgr

  • insert key/value-pair if key is NOT set
  • key string|int
  • value mixed
  • return KeyValueMgr
* insert array key/value-pairs (overwrite if key exists)
configDataArray  array( key => value )
* return KeyValueMgr

  • insert array key/value-pairs where key NOT exists
  • configDataArray array *( key => value )
  • return KeyValueMgr <br><br>
* unset key/value pair
* key    string|int
* return KeyValueMgr

  • unset key/value pairs
  • keyArr array *( key )
  • return KeyValueMgr
* unset all OTHER key/value-pairs 
* keyToKeep  string|int 
* return KeyValueMgr

  • unset all OTHER key/value-pairs
  • keyArrToKeep array *( key )
  • return KeyValueMgr <br><br>
* Return nice edited string content output


###### Sponsorship

Donation using <a href="https://paypal.me/kigkonsult?locale.x=en_US" rel="nofollow">paypal.me/kigkonsult</a> are appreciated. 
For invoice, <a href="mailto:ical@kigkonsult.se">please e-mail</a>.

###### INSTALL

composer require kigkonsult\keyvaluemgr:dev-master


Composer, in your `composer.json`:

{

"require": {
    "kigkonsult\keyvaluemgr": "dev-master"
}

}


Composer, acquire access

use Kigkonsult\KeyValueMgr\KeyValueMgr; ... include 'vendor/autoload.php';



Otherwise , download and acquire..

use Kigkonsult\KeyValueMgr\KeyValueMgr; ... include 'pathToSource/kigkonsult/keyvaluemgr/autoload.php';



###### Support

For support go to [github.com KeyValueMgr]


###### License

This project is licensed under the LGPLv3 License


[Composer]:https://getcomposer.org/
[github.com KeyValueMgr]:https://github.com/iCalcreator/keyvaluemgr
For more information send a message to info at phpclasses dot org.