PHP code example of t4web / authentication
1. Go to this page and download the library: Download t4web/authentication 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/ */
t4web / authentication example snippets
return array(
'modules' => array(
// ...
'T4web\Authentication',
),
// ...
);
'need-authorization-callback' => function(RouteMatch $match) {
$name = $match->getMatchedRouteName();
if ($name == 'auth-login') {
return false;
}
if (strpos($name, 'admin') !== false) {
return true;
}
return false;
},
'router' => array(
'routes' => array(
'auth-login' => array(
'options' => array(
'defaults' => array(
'layout' => 'layout/my_auth_layout',
'redirect-to-url' => '/some/uri',
),
),
),
),
),
'service_manager' => [
'factories' => [
Zend\Authentication\Adapter\AdapterInterface::class => Adapter\MyAdapter::class,
]
]
'auth-accounts' => [
'someUser1' => 'str0ngp@ssw0rd',
'someUser2' => '111',
],
'service_manager' => [
'factories' => [
Zend\Authentication\Adapter\AdapterInterface::class => \T4web\Authentication\Adapter\TableFactory::class,
]
],
'auth' => [
'table-adapter' => [
'table-name' => 'users',
'identity-column' => 'email',
'credential-column' => 'password',
],
],
bash
$ php composer.phar update