Search by

astral-php / astral-auth-extra

astral-php

Auth avancée pour Astral MVC — throttling login, remember-me, journal des tentatives.

Package info

github.com/astral-php/astral-auth-extra

pkg:composer/astral-php/astral-auth-extra

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2026-08-30 08:02 UTC

This package is auto-updated.

Last update: 2026-08-30 08:09:22 UTC


README

Auth avancée optionnelle pour Astral MVC : throttling login, remember-me, journal des tentatives.

Le core Astral garde une auth simple (Core\Auth\Auth). Ce package ajoute les garde-fous sans alourdir le framework.

PHP Version

Statut : MVP local (Phase C) — pas encore publié sur Packagist.

Compatibilité

  • PHP : ^8.1 (8.1 → 8.5)
  • Astral MVC : ^1.2 (ServiceProvider + Cache + Logger + PDO)

Installation (quand publié)

composer require astral-php/astral-auth-extra

En local (workspace components-astral) :

"repositories": [
  { "type": "path", "url": "../components-astral/astral-auth-extra" }
]
composer require astral-php/astral-auth-extra:@dev

ServiceProvider

Dans config/dependencies.php :

use Astral\AuthExtra\AuthExtraServiceProvider;

return [
    // …
    AuthExtraServiceProvider::class,
];

Config optionnelle (config/app.php)

'auth_extra' => [
    'max_attempts'    => 5,
    'decay_seconds'   => 900,   // 15 min
    'remember_days'   => 30,
    'log_to_database' => false, // true → table login_attempts
],

Migrations

Copier (ou symlink) les fichiers de database/migrations/ vers le projet hôte, puis :

php bin/console migrate
  • login_attempts — journal DB (si log_to_database = true)
  • remember_tokens — obligatoire pour remember-me

Fonctionnalités MVP

Service Rôle
LoginThrottler Bloque après N échecs (e-mail + IP), via Cache Astral
LoginAttemptLogger Log fichier (+ DB optionnelle)
RememberMeManager Cookie HttpOnly selector:validator + rotation

Voir examples/login-integration.php pour le branchement dans AuthController.

2FA

Hors MVP — prévu en itération ultérieure du même package.

Tests

composer install
composer test