PHP code example of wuninsu / nativephp-secure-storage
1. Go to this page and download the library: Download wuninsu/nativephp-secure-storage 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/ */
wuninsu / nativephp-secure-storage example snippets
use Wuninsu\NativeSecureStorage\Facades\SecureStorage;
SecureStorage::set('api_token', $token); // true on success
SecureStorage::get('api_token'); // string, or null
SecureStorage::delete('api_token'); // true, also when nothing was stored
use Wuninsu\NativeSecureStorage\SecureStorageStatus;
$result = SecureStorage::read('api_token');
match ($result->status) {
SecureStorageStatus::Found => $result->value,
SecureStorageStatus::NotFound => null, // nothing stored
SecureStorageStatus::Unavailable => null, // iOS: the phone is locked; try again later
SecureStorageStatus::Failed => null, // no plugin, no bridge, or a native error ($result->code)
};
if (SecureStorage::isAvailable()) {
// inside a built app that contains this plugin
}