PHP code example of danny3b / cakephp-remember-me

1. Go to this page and download the library: Download danny3b/cakephp-remember-me 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/ */

    

danny3b / cakephp-remember-me example snippets


Plugin::load('RememberMe');

$this->loadComponent('RememberMe.RememberMe');

$this->loadComponent('RememberMe.RememberMe', [
    'cypherKey' => "17485937564892755682047369192734583655920926", // Random unuqie string to encrypt/decrypt data. If not set, default salt value of the application will be used.
    'cookieName' => "rememberme", // Name of the cookie.
    'period' => '14 Days' // Time period
]);

$this->RememberMe->rememberData("[email protected]"); // email address of user being logged in
// or you can use the array as well
$this->RememberMe->rememberData([
  'email' => '[email protected]',
  'someUniqueKey' => 'someuniquevalue'
]);

$isRemembered = $this->RememberMe->getRememberedData();

// code to check this data against database
// set the session
// ...