PHP code example of freedomsex / time-token-service
1. Go to this page and download the library: Download freedomsex/time-token-service 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/ */
freedomsex / time-token-service example snippets
use FreedomSex\Services\TimeTokenService;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
// любой PSR-6 совместимый экземпляр кэша
// для примера указан FilesystemAdapter Symfony
// обычно используется MemcachedAdapter
$memory = new FilesystemAdapter();
$timeTokenService = new TimeTokenService($memory);
$id = '123456'; // любая строка
$timeTokenService->start($id, 2);
$timeTokenService->ready($id); // FALSE
sleep(2); // Подождать
$timeTokenService->ready($id); // TRUE
// Параметры $delay и $expire не обязательны
$timeTokenService = new TimeTokenService($memory, $delay = null, $expire = null);
// OR
$timeTokenService->setDelay($time);
$timeTokenService->setExpire($time);
// OR
$timeTokenService->start($id, $delay = null, $expire = null);
// Параметры $delay и $expire не обязательны
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.