PHP code example of xtfer / keyparty

1. Go to this page and download the library: Download xtfer/keyparty library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xtfer / keyparty example snippets


// Start KeyParty and add a JSON Jar to store data in.
$keyparty = new \Keyparty\KeyParty()->addJar('test');

// Create some data to store.
$my_data = array('foo', 'bar');

// Set the data
$keyparty->set('test', 'some_key', $my_data);

// Start KeyParty and add a JSON Jar to store data in.
$keyparty = new \Keyparty\KeyParty()->addJar('test');

// Create some data to store.
$my_data = array('foo', 'bar');

// Set the data
$keyparty->set('test', 'some_key', $my_data);

// Set data without overwriting existing data.
// This will throw a RecordExistsException...
$keyparty->set('test', 'some_key', $my_data);

// You can also do it this way, however this won't use Object Converters, so you may 
lose some functionality, such as the ability to return properly classed objects from
the JSON store.
$jar = $keyparty->useJar('test');

$jar->insert('some_key', $my_data);
// or
$jar->update('some_key', $my_data);
// or
$jar->upsert('some_key', $my_data);

// Get your data back
$result = $keyparty->get('test', 'some_key');
// or
$result = $jar->select('some_key');