Follow me on twitter…

Zend_Auth adapter

If you want to use Redis to store users data, you need to include Redis Zend_Auth adapter for authorization logic:


$auth = Zend_Auth::getInstance();
$options = array(
    'userIdKey'   => 'user_ids:*',
    'userdatakey' => 'users:*',
    'rediska'     => new Rediska(),
$adapter = new Rediska_Zend_Auth_Adapter_Redis($options);

// Set login and password

// Authorization
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
    echo 'Success';
} else {
    echo 'Login or password invalid';


Adapter options:

  • userIdKey - Redis key where you store relation between login and id. * replaced to identity (login)
  • userDataKey - Redis key where you store user data
  • credentialAttributeName - Name of credential (password) attribute in user data
  • userDataIsArray - Set true if you store user data in associative array
  • identity - User identity (login) for authorization
  • credential - User credintial (password) for authorization
  • rediska - Rediska instance name, Rediska object or array of options


Fork me on GitHub