PHP code example of nigelgreenway / tutis

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

    

nigelgreenway / tutis example snippets

 php
$username = 'bob.builder';

$password = '9455w0rd';
$options = [
    'cost' => 12,
];
$passwordHandler = Tutis\Handler\BasicPasswordHandler::hash($password, $options);

$pass = Tutis\Pass::generate($username, $passwordHandler, Tutis\Pass::ACTIVE);
echo $pass->toUsername() // bob.builder
echo $pass->toHash() // $0m3l0ngh4sh
 php
$username = 'bob.builder';
$password = '9455w0rd';
$hash     = '$0m3l0ngh4sh';

$pass = Tutis\Pass::authenticate(
    $username,
    $password,
    $hash,
    BasicPasswordHandler::class,
    1
)

var_dump($pass); // Instance of Tutis\Pass