1. Go to this page and download the library: Download tiqr/tiqr-server-libphp 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/ */
# Create the Tiqr_Service
$service = new Tiqr_Service($options)
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
// Create a log channel that logs alle messages of level DEBUG and above to a file
$logger = new Logger('name');
$logger->pushHandler(new StreamHandler('path/to/your.log', Logger::DEBUG));
$this->tiqrService = new Tiqr_Service($logger, $options);
$user_storage = Tiqr_UserStorage::getUserStorage(
'pdo',
$logger,
array(
'dsn' => 'mysql:host=mysql.example.com;dbname=tiqr',
'username' => 'tiqr_rw',
'password' => 'secret',
'table' => 'user'
)
);
$secret_storage = Tiqr_UserSecretStorage::getSecretStorage(
'pdo',
$logger,
array(
'dsn' => 'mysql:host=mysql.example.com;dbname=tiqr',
'username' => 'tiqr_rw',
'password' => 'secret',
'table' => 'user',
// Encrypt the secret using an AES key
'encryption' => [
'type' => 'openssl',
'cipher' => 'aes-256-cbc', // Cypher to use for encryption
'key_id' => 'key_2024', // ID of the key to use for encryption
'keys' => [
'key_2024' => '0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20', // Key used for encryption
'key_2015' => '303132333435363738393a3b3c3d3e3f303132333435363738393a3b3c3d3e3f', // A (old) key that can be used for decryption
],
],
)
);
$user_storage->createUser('jdoe', 'John Doe'); // Create user with id 'jdoe' and displayname 'John Doe'. 'jdoe' is the user's unique identifier.
$secret_storage->setSecret('jdoe', '4B7AD80B70FC758C99EFDD7E93932EEE43B9378A1AE5E26098B912C2ECA91828'); // Set the user's secret
// Set some other data that is associated with the user
$user_storage->setNotificationType('jdoe', 'APNS');
$user_storage->setNotificationAddress('jdoe', '251afb4304140542c15252e4a07c4211b441ece5');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.