MapStore is a key-value store plugin for CakePHP framework. It is inspired by other key-value store projects.
The easiest & recommended way to install MapStore is via composer. Run the following command:
composer require avinashjoshi/cakephp-mapstore
After that you should load the plugin in your app editing config/bootstrap.php
:
Plugin::load('MapStore');
After loading the plugin you need to migrate the tables for the plugin using:
bin/cake migrations migrate -p MapStore
Configuration allows to specify if the value shoud be encrypted or not.
- encrypt (required/optional): Set to false if you would like to disable encryption (Default is
true
). - key (required/optional): you can specify a key to be used by Security class to encrypt/decrypt value.
- salt (required/optional): you can specify a salt to be used by Security class to encrypt/decrypt value.
key and salt can also be set globally by adding them to CakePHP's application configuration at app.php
:
<?php
return [
'Security' => [
'salt' => 'some long & random salt',
'key' => 'some long & random key'
]
];
You can grab a good pair of key and salt at Random Key Generator.
<?php
use MapStore\Store\MapStore;
$store = MapStore::load('store_1');
$store->set('name', 'Avinash Joshi');
$store->get('name'); // Returns 'Avinash Joshi'
$store->delete('name');
$store->flush();
// Load the databases without database encryption
$store_2 = MapStore::load('store_2', ['encrypt' => false]);
Feel free to open an issue if you need help or have ideas to improve this plugin.
Contributions and Pull Requests are always more than welcome!
- Follow CakePHP coding standard.
- Please, add Tests to new features.