PHP code example of fawno / drupal-password-hasher

1. Go to this page and download the library: Download fawno/drupal-password-hasher 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/ */

    

fawno / drupal-password-hasher example snippets


  use Fawno\Auth\DrupalPasswordHasher;

  $this->loadComponent('Auth', [
    'authenticate' => [
      'Form' => [
        'passwordHasher' => DrupalPasswordHasher::class,
        'fields' => [
          'username' => 'username',
          'password' => 'password',
        ]
      ]
    ],
  ]);

  use Fawno\Auth\DrupalPasswordHasher;

  class User extends Entity {
    protected function _setPassword ($value) {
      if (strlen($value)) {
        $hasher = new DrupalPasswordHasher();

        return $hasher->hash($value);
      }
    }
  }