After seeing all the authentication methods available, it is time to see how it will actually work when we have a database authentication in place. This recipe will explain all the ins and outs of this specific method.
A working Zend Framework 2 skeleton application with the PHP sqlite extension loaded and enabled.
Database authentication can very well be the most widely used authentication method there is. In this recipe we will set up our own database authentication.
We will create our database as soon as possible after initialization of the modules, so we will attach it to an event called route or MvcEvent::EVENT_ROUTE
. As a template for the Module.php
we can just copy over the Application/Module.php
file and change the namespace; we will be working in the onBootstrap
method anyway, and the rest of the Module
class can stay the same (but don't forget to change the namespace!).
Let's take...