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: 4

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-11-13 14:17 UTC

This package is auto-updated.

Last update: 2026-11-13 14:17:30 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 "Config/Services.php"
     public static function adminAuth($getShared = true)
     {
         if ($getShared) {
             return static::getSharedInstance(__FUNCTION__);
         }
         
         return new \BasicApp\AdminAuthShield\Services\AdminAuth;
     }
  1. Add to ".env"
Security.csrfProtection="session"
  1. Add to "Config\Autoload"
public $helpers = [
    /* other helpers here... */
    'auth', 
    'setting'
];
  1. Run
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