basic-app / admin-auth-shield
dev-main
2026-11-20 05:59 UTC
Requires
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-20 05:59:18 UTC
README
Install
-
Install Shield
-
Run
composer require basic-app/admin-auth-shield
- Add to "Config/Routes.php"
helper(['admin_auth_shield']);
if (!admin_auth_shield_routes($routes))
{
// default auth routes
service('auth')->routes($routes);
}
- Add to "Config/Filters.php"
public array $aliases = [
/* other aliases here... */
'adminsession' => \BasicApp\AdminAuthShield\Filters\AdminSessionAuth::class,
'admingroup' => \BasicApp\AdminAuthShield\Filters\AdminGroupFilter::class
];
public array $filters = [
/* other filters here... */
'adminsession' => [
'before' => ['admin', 'admin/*']
],
'admingroup:admin' => [
'before' => ['admin', 'admin/*']
]
];
- Add to ".env"
AdminAuth.credentialClass="BasicApp\AdminAuthShield\Services\AdminAuth"
- Add to "Config\Autoload"
public $helpers = [
/* other helpers here... */
'auth',
'setting'
];
- Add to ".env"
Security.csrfProtection="session"
In some cases, this step can be skipped.
- Run
php spark migrate -all
php spark db:seed "BasicApp\AdminAuthShield\Database\Seeds\DemoSeeder"
Access backend by opening http://localhost:8080/index.php/admin in a browser.
login: admin@example.org
password: admin
You need to restart the Spark server so the new settings take effect.