websk / php-auth
Authorization and user management
Requires
- php: ^8.3
- ext-pdo: *
- ext-pdo_mysql: *
- juliangut/slim-php-di: ^4.2
- phpmailer/phpmailer: ^7.1
- psr/container: ^2.0
- psr/http-message: ^2.0
- psr/http-server-handler: ^1.0
- slim/psr7: ^1.8
- slim/slim: ^4.15
- websk/php-cache: 3.0.*
- websk/php-captcha: 3.0.*
- websk/php-config: 2.2.*
- websk/php-console: 2.3.*
- websk/php-crud: 3.0.*
- websk/php-db: 3.0.*
- websk/php-entity: 3.0.*
- websk/php-filemanager: 3.0.*
- websk/php-slim: 2.4.*
- websk/php-utils: 3.0.*
- websk/php-view: 3.1.*
Requires (Dev)
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^12.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 3.0.0
- 2.4.10
- 2.4.9
- 2.4.8
- 2.4.7
- 2.4.6
- 2.4.5
- 2.4.4
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.8
- 2.1.7
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.1
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- dev-kss_external_auth
This package is auto-updated.
Last update: 2026-10-17 05:21:53 UTC
README
Authentication and user-management components for the WebSK/Slim stack.
Requirements
- PHP 8.3 or newer; the demo Docker environment uses PHP 8.5.11.
- PDO with the MySQL driver.
- The extensions required by the selected WebSK cache, CAPTCHA and file-storage backends.
The current dependency stack uses Slim 4.15, PHP-DI 7 with PHP attributes and the WebSK 3.x database/entity/CRUD packages.
Install
https://packagist.org/packages/websk/php-auth
install dependency using Composer
composer require websk/php-auth
Config
- php-auth no special configs
Existing installations must apply the SQL statements in dumps/db_auth.sql. The password column is widened to 255 characters and the confirmation-code column to 64 characters.
New passwords use password_hash(). Legacy salted MD5 passwords remain valid for one successful login and are then automatically replaced with a modern hash. Session and confirmation tokens are generated with random_bytes(), and authentication cookies use HttpOnly, SameSite=Lax and Secure on HTTPS requests.
Development checks
composer validate --strict composer check-platform-reqs composer dump-autoload --optimize --strict-psr composer check composer audit --locked
MySQL integration tests can be run separately with:
composer test:mysql
Demo
-
Установить mkcert, https://github.com/FiloSottile/mkcert
-
Выполнить:
mkcert --install
-
Сделать самоподписанный сертификат для
php-auth.devbox:mkcert php-auth.devbox
-
Скопировать полученные файлы _wildcard.php-auth.devbox.pem и _wildcard.php-auth.devbox.pem в
var/docker/nginx/sites -
Прописать в
/etc/hostsили аналог в Windows%WINDIR%\System32\drivers\etc\hosts127.0.0.1 php-auth.devbox -
Создаем локальный конфиг, при необходимости вносим изменения:
cp config/config.default.php config/config.php
-
Заходим в директорию с docker-compose:
cd var/docker -
Создаем локальный env файл, при необходимости вносим изменения:
cp .example.env .env
-
Собираем и запускаем докер-контейнеры:
docker compose up -d --build
-
Проверяем, что контейнер использует PHP 8.5.11, и устанавливаем зависимости:
docker compose exec php-fpm php -v docker compose exec php-fpm composer install
-
Выполняем миграции БД
docker compose exec php-fpm php vendor/bin/websk_db_migration.php migrations:migration_autoor run handle process migration:
docker compose exec php-fpm php vendor/bin/websk_db_migration.php migrations:migration_handle -
Создаем пользователя для входа в админку
docker compose exec php-fpm php bin/websk_auth_create_user.php auth:create_user -
open
https://php-auth.devbox