sherlockode/user-confirmation-bundle
Composer 安装命令:
composer require sherlockode/user-confirmation-bundle
包简介
Symfony Bundle for the confirmation process of a user registration
README 文档
README
The SherlockodeUserConfirmationBundle provides a way to create a user account that will stay disabled until the user visits a confirmation link sent by email and sets a password.
Prerequisites
This version of the bundle requires Symfony 7.* and FOSUserBundle
Installation
Step 1: Install SherlockodeUserConfirmationBundle
Install with Composer:
$ composer require sherlockode/user-confirmation-bundle
Enable the bundle in the Symfony kernel:
<?php // config/bundles.php return [ // ... Sherlockode\UserConfirmationBundle\SherlockodeUserConfirmationBundle::class => ['all' => true], ];
Step 2: Configure the bundle
Import the routing in config/routes.yaml
sherlockode_user_confirmation: resource: "@SherlockodeUserConfirmationBundle/Controller/" type: attribute
Then create the configuration in config/packages/sherlockode_user_confirmation.yaml
sherlockode_user_confirmation: from_email: no-reply@awesome.com # From email address from_name: John Doe # Name of the expeditor email_subject: Please confirm your account # The subject for the confirmation email (optional) redirect_after_confirmation: admin_dashboard # The route name to redirect the user after confirmation
Customization
Extend the confirmation form template
To extend the confirmation form template, just update your sherlockode_user_confirmation.yaml
sherlockode_user_confirmation: templates: confirmation_form: 'Registration/confirmation.html.twig'
Then in your template, add a placeholder for the block sherlockode_user_confirmation_form
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> </head> <body> <h1>My awesome app !</h1> <div> {# The form will be render here #} {% block sherlockode_user_confirmation_form %}{% endblock %} </div> </body> </html>
Extend the confirmation email
If you want to extend the confirmation email template, you should add the path in your config.yml
sherlockode_user_confirmation: templates: confirmation_email: 'Email/registration.html.twig'
In this template, you have access to the user object, and to a variable named confirmationUrl which contains the url to access the confirmation form.
Send confirmation email
If you want to send the confirmation again for an existing user, use the following link :
<a href="{{ path('sherlockode_user_confirmation_send_confirmation', {id: userId}) }}"> Send confirmation email </a>
sherlockode/user-confirmation-bundle 适用场景与选型建议
sherlockode/user-confirmation-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.47k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sherlockode/user-confirmation-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sherlockode/user-confirmation-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.47k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-04