PHP code example of muffin / tokenize

1. Go to this page and download the library: Download muffin/tokenize 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/ */

    

muffin / tokenize example snippets


Plugin::load('Muffin/Tokenize', ['routes' => true]);

Configure::write('Muffin/Tokenize', [
    'lifetime' => '3 days', // Default value
    'length' => 32, // Default value
    'table' => 'tokenize_tokens', // Default value
]);

$this->addBehavior('Muffin/Tokenize.Tokenize', [
    'fields' => ['password'],
]);

$this->addBehavior('Muffin/Tokenize.Tokenize', [
    'fields' => ['password'],
    'implementedEvents' => [
        'Model.beforeSave' => 'beforeSave',
        'Model.afterSave' => 'afterSave',
    ],
]);

$this->Users->tokenize($user['id']);

$result = $this->Users->Tokens->verify($token);