Search by

basic-app / admin-auth-shield

basic-app

Package info

github.com/basic-app/admin-auth-shield

pkg:composer/basic-app/admin-auth-shield

Statistics

Installs: 15

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-11-20 05:59 UTC

This package is auto-updated.

Last update: 2026-11-20 05:59:18 UTC


README

Install

  1. Install Shield

  2. Run

composer require basic-app/admin-auth-shield
  1. Add to "Config/Routes.php"
helper(['admin_auth_shield']);
if (!admin_auth_shield_routes($routes))
{
    // default auth routes
    service('auth')->routes($routes);
}
  1. 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/*']
        ]
    ];
  1. Add to ".env"
AdminAuth.credentialClass="BasicApp\AdminAuthShield\Services\AdminAuth"
  1. Add to "Config\Autoload"
public $helpers = [
    /* other helpers here... */
    'auth', 
    'setting'
];
  1. Add to ".env"
Security.csrfProtection="session"

In some cases, this step can be skipped.

  1. 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.