PHP code example of netpromotion / data-signer

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

    

netpromotion / data-signer example snippets


/** @var int $userId */
/** @var Netpromotion\DataSigner\DataSignerInterface $signer */
$token = (string) $signer->withDomain('user.reset_password')->signData($userId, 12 * 3600);
send_reset_password_email($userId, $token);

/** @var Netpromotion\DataSigner\DataSignerInterface $signer */
$userId = $signer->withDomain('user.reset_password')->getData($_GET['token']);
set_password($userId, $_POST['new_password']);