PHP code example of org_heigl / password-middleware
1. Go to this page and download the library: Download org_heigl/password-middleware 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/ */
org_heigl / password-middleware example snippets
use Org_Heigl\PasswordMiddleware\PasswordMiddleware;
use Slim\App;
$app = new App();
$app->add(new PasswordMiddleware('password', 'password-verification'));
class Controller
{
public function handle($request, $response): ServerResponse
{
/** @var \Org_Heigl\Password\Password $password */
$password = $request->getParsedBody()['password'];
$passwordVerification = $request->getParsedBody()['password-verification'];
if ($password == $passwordVerification) {
throw new RuntimeException('Passwords do not match');
}
}
}