PHP code example of diuitapi / php-session-helper
1. Go to this page and download the library: Download diuitapi/php-session-helper 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/ */
diuitapi / php-session-helper example snippets
use Diuit\DiuitTokenHelper;
$session = (new DiuitTokenHelper())->setAppId('your_app_id') // Configures app ID
->setAppKey('your_app_key') // Configures app key
->setKeyID('your_key_id') // Configures key id for finding public key
->setPrivateKey('file://your_pem_file_path') // Configures private key (you can either use file path or plain text)
->setUserSerial('user_serial') // Configures user serial
->setExpDuration(7*24*3600) // Configures length of session valid duration (in seconds), example is in length of a week
->getSessionToken('your_device_serial', 'gcm', 'device_push_token'); // Configures device serial, platform and push token(optional) and retrieves session token
echo $session; // will print session token
shell
composer