This library provides database table adapters for laminas/laminas-authentication that query through php-db/phpdb:
PhpDb\Authentication\Adapter\DbTable\CallbackCheckAdapterPhpDb\Authentication\Adapter\DbTable\CredentialTreatmentAdapter
They are ports of laminas-authentication's laminas-db DbTable adapters, so
moving an application from laminas-db to phpdb is mostly a namespace change. See
Migrating from laminas-authentication for the
differences.
Run the following to install this library:
$ composer require php-db/phpdb-laminas-authenticationuse PhpDb\Authentication\Adapter\DbTable\CallbackCheckAdapter;
$authAdapter = new CallbackCheckAdapter(
$dbAdapter, // a PhpDb\Adapter\AdapterInterface
'users',
'username',
'password',
static fn(string $hash, string $password): bool => password_verify($password, $hash),
);
$result = $authAdapter
->setIdentity($username)
->setCredential($password)
->authenticate();