PHPackages                             germania-kg/permanent-authentication - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. germania-kg/permanent-authentication

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

germania-kg/permanent-authentication
====================================

1.0.17(4y ago)01261MITPHPPHP ^5.6|^7.0

Since Dec 14Pushed 4y ago2 watchersCompare

[ Source](https://github.com/GermaniaKG/PermanentAuth)[ Packagist](https://packagist.org/packages/germania-kg/permanent-authentication)[ RSS](/packages/germania-kg-permanent-authentication/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (7)Versions (20)Used By (1)

Germania KG · PermanentAuth
===========================

[](#germania-kg--permanentauth)

**This package was destilled from legacy code!**

[![Packagist](https://camo.githubusercontent.com/33b3e9e15c62febf6ab6920e35e0098c2ebb9958f4f19d08982bfa17b933518f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765726d616e69612d6b672f7065726d616e656e742d61757468656e7469636174696f6e2e7376673f7374796c653d666c6174)](https://packagist.org/packages/germania-kg/permanent-authentication)[![PHP version](https://camo.githubusercontent.com/0b79636abab5a482529691daf8696cb4b96e70cb40d41c577fd45b621e68cc06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6765726d616e69612d6b672f7065726d616e656e742d61757468656e7469636174696f6e2e737667)](https://packagist.org/packages/germania-kg/permanent-authentication)[![Build Status](https://camo.githubusercontent.com/07dd44d345b3648ba96bc1ca496f5d927bba6113b6856749bc71fc9d289f6d9e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4765726d616e69614b472f5065726d616e656e74417574682e7376673f6c6162656c3d5472617669732532304349)](https://travis-ci.org/GermaniaKG/PermanentAuth)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5e9a2dabafb8490a4fd632b702057c35261bcc40c460d713088bd09c1e7fc572/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4765726d616e69614b472f5065726d616e656e74417574682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/GermaniaKG/PermanentAuth/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/44b091debe30f1f3bf12bea25519a10e4b460ce82a0217503392565419f72c40/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4765726d616e69614b472f5065726d616e656e74417574682f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/GermaniaKG/PermanentAuth/?branch=master)[![Build Status](https://camo.githubusercontent.com/2fe26cff4e3ea15e026ae29f5b6e6908af37f307a6a7077cd7875b67b7e42f7c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4765726d616e69614b472f5065726d616e656e74417574682f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/GermaniaKG/PermanentAuth/build-status/master)

Requirements
------------

[](#requirements)

- Anthony Ferrara's [ircmaxell/RandomLib](https://github.com/ircmaxell/RandomLib)

Installation with Composer
--------------------------

[](#installation-with-composer)

```
$ composer require germania-kg/permanent-authentication
```

**MySQL users** may install the table *auth\_logins* using `auth_logins.sql.txt` in `sql/` directory.

Create a persistent login
-------------------------

[](#create-a-persistent-login)

This Callable stores a selector and token pair in a cookie on the client side and stores the selected and hashed token in the database. Five ingredients are required:

**rnd:** An instance of [RandomLib](https://github.com/ircmaxell/RandomLib) Generator for creating secure random numbers and strings.

**client\_storage:** A Callable that stores the selector and token pair on the client-side. On error, it should throw an Exception implementing *Germania\\PermanentAuth\\Exceptions\\StorageExceptionInterface.* – Create your own or try the implementation described in [ClientStorage](#ClientStorage) section below

**hasher:** A Callable that securely hashes the random token created by RandomLib. It is recommended to use PHP's [password\_hash](http://php.net/manual/de/function.password-hash.php).

**server\_storage:** A Callable that stores selector and token hash in the database. On error, it should throw an Exception implementing *Germania\\PermanentAuth\\Exceptions\\StorageExceptionInterface.* – Create your own or try the implementation described in [PdoStorage](#PdoStorage) section below.

**valid\_until:** A PHP [DateTime](http://php.net/manual/de/class.datetime.php) object which holds the expiration date and time.

```
