pskuza / php_user
基本的PHP用户类。
v0.14
2017-06-30 10:41 UTC
Requires
- php: ^7
- bjeavons/zxcvbn-php: ^0.3
- egulias/email-validator: ~2.1
- google/recaptcha: ~1.1
- paragonie/constant_time_encoding: 2.*
- phpmailer/phpmailer: ~5.2
- pskuza/php_session: 0.*
- spomky-labs/php-aes-gcm: 1.*
- twig/twig: ^2.0
Requires (Dev)
- guzzlehttp/guzzle: ~6.0
- phpunit/phpunit: ^6
This package is not auto-updated.
Last update: 2024-09-29 04:08:58 UTC
README
- 使用php_session进行会话管理。(https://github.com/pskuza/php_session)
- 检查弱密码。(https://github.com/bjeavons/zxcvbn-php)
- 使用AES-GCM加密password_hash。(https://github.com/Spomky-Labs/php-aes-gcm)
- 在过多的注册/登录尝试上强制使用验证码。(https://github.com/google/recaptcha)
- 使用模板发送确认和重置的电子邮件。(https://github.com/twigphp/Twig)
- 使用PHPMailer发送实际电子邮件。(https://github.com/PHPMailer/PHPMailer)
安装
php composer.phar require "pskuza/php_user"
基本用法和功能
<?php require('vendor/autoload.php'); use php_user\user; //for memcached as cache //check doctrine/cache on how to use the others $memcached = new Memcached(); $memcached->addServer('127.0.0.1', 11211); $cacheDriver = new \Doctrine\Common\Cache\MemcachedCache(); $cacheDriver->setMemcached($memcached); //for mysql session storage //check pdo for other connection handlers $db = \ParagonIE\EasyDB\Factory::create( 'mysql:host=127.0.0.1;dbname=notdev', 'notroot', 'averysecurerandompassword' ); $session = new php_session\session($db, $cacheDriver); session_set_save_handler($session, true); $user = new php_user\user($session, $db); //for more up to date usage see tests/UserMysql.php