1. Go to this page and download the library: Download kagatan/user-options 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/ */
kagatan / user-options example snippets
use Kagatan\UserOption\UserOption;
$user_id = 777;
$key = 'test_key';
$value = 'test_value';
$data = [
'test_key_a_1' => 'test_value_a_1',
'test_key_a_2' => 'test_value_a_2',
'test_key_b_1' => 'test_value_b_1',
'test_key_b_2' => 'test_value_b_2'
];
// Set key => value for User
UserOption::set($user_id, $key, $value);
// Get value by key for User
$option = UserOption::get($user_id, $key);
dump($option);
// Remove by key for User
UserOption::remove($user_id, $key);
// Set collection [key => value] for User
UserOption::set($user_id, $data);
// Get all options for User
$options = UserOption::getAll($user_id);
dump($options);
// Get options by condition for User
$options = UserOption::getAll($user_id, 'test_key_a%');
dump($options);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.