phphleb/hlogin
Composer 安装命令:
composer require phphleb/hlogin
包简介
Registration module for the HLEB2 project
README 文档
README
The HLOGIN library expands the capabilities of the HLEB2 framework by adding full-fledged user registration on the site which is characterized by simplicity of settings and quick installation and (at the same time) convenient and diverse functionality that supports multilingualism and several design options. Optionally you can display a feedback form that goes in addition to registration and authorization. In the automatically created admin panel you will find tools for user management and display settings. After that you can immediately direct your thoughts to creating content for the site.
Supported MySQL / MariaDB / PostgreSQL / SQLite
Required PHP extensions: json, gd, pdo, pdo-mysql / pdo-pgsql / pdo-sqlite, readline
Installation
Step 1. Installation via Composer into an existing HLEB2 project:
$ composer require phphleb/hlogin
Step 2. Installing the library into the project. You will be asked to choose a design from several:
$ php console phphleb/hlogin add
$ composer dump-autoload
Connection
Step 3. Before doing this action you must have a valid connection to the database. In the project settings /config/database.php you need to specify the connection and specify its name there in the base.db.type option.
After that the console command creates the necessary tables and a user with administrator rights (you will be prompted to specify an E-mail and password):
$ php console hlogin/create-login-table
$ php console hlogin/create-admin
If it is not possible to execute a console command, then create tables using an SQL query from the /vendor/phphleb/hlogin/planB.sql file.
After that, register an administrator and set his regtype equal to 11.
Step 4. Now you can go to the main stub page of the site if it is installed without changes and make sure that the authorization panels are available.
If the library is not installed in the developed project on the HLEB2 framework from the beginning you should check the entry on the /en/login/action/enter/ page of the site.
Step 5. Setting up registration on the site on specific pages through routing.
To do this you need to set the following conditions in the routing files (project folder /routes/):
use App\Middlewares\Hlogin\Registrar; use Phphleb\Hlogin\App\RegType; Route::toGroup()->middleware(Registrar::class, data: [RegType::UNDEFINED_USER, '>=']); // Routes in this group will be available to all unregistered and registered users except those that were marked deleted and banned. Route::endGroup(); Route::toGroup()->middleware(Registrar::class, data: [RegType::PRIMARY_USER, '>=']); // Routes in this group will be available to those who pre-registered (but didn't confirm E-mail), as well as to all registered users (including administrators). Route::endGroup(); Route::toGroup()->middleware(Registrar::class, data: [RegType::REGISTERED_USER, '>=']); // Routes in this group will be available to all users who have completed full registration (confirmed by E-mail including administrators). Route::endGroup(); Route::toGroup()->middleware(Registrar::class, data: [RegType::REGISTERED_COMMANDANT, '>=']); // Routes in this group will be available only to administrators. Route::endGroup(); Route::toGroup()->middleware(Registrar::class, data: [RegType::PRIMARY_USER, '>=', Registrar::NO_PANEL]); // Routes with check registration without displaying standard panels and buttons. Route::endGroup(); Route::toGroup()->middleware(Registrar::class, data: [RegType::PRIMARY_USER, '>=', Registrar::NO_BUTTON]); // Routes with check registration without displaying standard buttons. Route::endGroup();
It should be borne in mind that pages that don't fall into any of these groups with conditions are outside the registration rules and this library is not connected to them.
Step 6. Configuration. After authorization in the administrator profile (/en/login/profile/) the login button to the admin panel is displayed. You can configure registration panels and other conditions there.
If you need to display data depending on the type of user registration you can use the following checks:
use Phphleb\Hlogin\App\AuthUser; $user = AuthUser::current(); if ($user) { // Status for the confirmed user. $confirm = $user->isConfirm(); // Obtaining the user's E-mail. $email = $user->getEmail(); // Result of the administrator check. $isAdmin = $user->isSuperAdmin(); // ... // } else { // The current user is not authorized. }
More detailed information in the framework documentation.
phphleb/hlogin 适用场景与选型建议
phphleb/hlogin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 192 次下载、GitHub Stars 达 3, 最近一次更新时间为 2021 年 10 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 phphleb/hlogin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phphleb/hlogin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 192
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-01