PHP code example of blastanders / myth-auth
1. Go to this page and download the library: Download blastanders/myth-auth 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/ */
blastanders / myth-auth example snippets
$psr4 = [
'Config' => APPPATH . 'Config',
APP_NAMESPACE => APPPATH,
'App' => APPPATH,
'Myth\Auth' => APPPATH . 'ThirdParty/myth-auth/src',
];
$authenticate = service('authentication');
$authenticate = service('authentication', 'jwt');
$authorize = service('authorization');
$authenticate = service('passwords');
public $ruleSets = [
\CodeIgniter\Validation\Rules::class,
\CodeIgniter\Validation\FormatRules::class,
\CodeIgniter\Validation\FileRules::class,
\CodeIgniter\Validation\CreditCardRules::class,
\Myth\Auth\Authentication\Passwords\ValidationRules::class,
];
$validation->setRules([
'username' => ' ]);
$user = $userModel
->withGroup('guests')
->insert($data);
public $collectors = [
\CodeIgniter\Debug\Toolbar\Collectors\Timers::class,
\CodeIgniter\Debug\Toolbar\Collectors\Database::class,
...
\Myth\Auth\Collectors\Auth::class,
];
'login' => \Myth\Auth\Filters\LoginFilter::class,
'role' => \Myth\Auth\Filters\RoleFilter::class,
'permission' => \Myth\Auth\Filters\PermissionFilter::class,
public filters = [
'login' => ['before' => ['account/*']],
];
public $globals = [
'before' => [
'honeypot',
'login',
...
$routes->get('admin/users', 'UserController::index', ['filter' => 'permission:manage-user'])
$routes->get('admin/users', 'UserController::index', ['filter' => 'role:admin,superadmin'])
$routes->group('admin', ['filter' => 'role:admin,superadmin'], function($routes) {
...
});