unknown/user-light

Symfony2 的轻量级用户处理包

1.0.4 2015-03-20 10:24 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:49:08 UTC


README

此包为您提供了

  • 从 php 5.3 迁移的理由
  • 包含 25+ phpspec 示例的 1k+ 行代码库
  • Symfony2 安全配置
  • 部分受保护网站的安全配置
  • Symfony2 防火墙
  • Doctrine ORM 的用户实体
  • 登录控制器
  • 登录模板
  • 登录事件记录器

问题和功能请求在 Github 问题跟踪器中跟踪 https://github.com/unknown-opensource/user-light/issues

安装

  1. 要使用 Composer 安装此包,只需将以下内容添加到您的 composer.json 文件中

    require: { ... "unknown/user-light": "1.0.4" }

  2. 然后注册包在 AppKernel::registerBundles() 中

    $bundles = array( ... new Unknown\Bundle\ReportBundle\UnknownUserLightBundle(), );

  3. 包含安全配置。

    imports: - { resource: @UnknownUserLightBundle/Resources/config/security.yml }

自定义用户实体

要为防火墙分配自定义用户实体,请使用包配置。

部分包配置

unknown_user_light:
    user_entity_class: Acme\CustomBundle\Entity\User

自定义登录事件记录

要将登录事件存储在数据库中,请在包配置中提供记录类。提供的类应实现 Unknown\Bundle\UserLightBundle\Entity\LoginRecordInterface 接口。

部分包配置

unknown_user_light:
    login_record_class: Acme\CustomBundle\Entity\LoginRecord

自定义登录主题

默认包配置查找 ::login.html.twig 模板。然而,已提供模板,可以通过以下方式配置包来使用

unknown_user_light:
    login_template: UserLightBundle::login.html.twig