https://github.com/avinashjoshi/cakephp-mapstore
A key-value store plugin for CakePHP
https://github.com/avinashjoshi/cakephp-mapstore
Last synced: 5 months ago
JSON representation
A key-value store plugin for CakePHP
- Host: GitHub
- URL: https://github.com/avinashjoshi/cakephp-mapstore
- Owner: avinashjoshi
- License: mit
- Created: 2015-11-18T17:39:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-09T14:15:08.000Z (over 10 years ago)
- Last Synced: 2024-04-25T06:01:40.889Z (about 2 years ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MapStore
[](LICENSE.txt)
[](https://travis-ci.org/avinashjoshi/cakephp-mapstore)
[](https://coveralls.io/github/avinashjoshi/cakephp-mapstore?branch=master)
MapStore is a key-value store plugin for [CakePHP](http://cakephp.org) framework. It is inspired by other key-value store projects.
## Installation
The easiest & recommended way to install MapStore is via [composer](http://getcomposer.org). 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
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
[
'salt' => 'some long & random salt',
'key' => 'some long & random key'
]
];
```
You can grab a good pair of key and salt at [Random Key Generator](http://randomkeygen.com/).
## Basic Usage
```php
set('name', 'Avinash Joshi');
$store->get('name'); // Returns 'Avinash Joshi'
$store->delete('name');
$store->flush();
```
## More Examples
```php
// Load the databases without database encryption
$store_2 = MapStore::load('store_2', ['encrypt' => false]);
```
## Support
Feel free to open an [issue](https://github.com/avinashjoshi/cakephp-mapstore) if you need help or have ideas to improve this plugin.
## Contributing
Contributions and Pull Requests are always more than welcome!
* Follow [CakePHP coding standard](http://book.cakephp.org/3.0/en/contributing/cakephp-coding-conventions.html).
* Please, add [Tests](http://book.cakephp.org/3.0/en/development/testing.html) to new features.