philiplb/crudlexuser
Composer 安装命令:
composer require philiplb/crudlexuser
包简介
CRUDlexUser is a library offering an user provider for symfony/security.
README 文档
README
CRUDlexUser is a library offering an user provider for symfony/security.
API Documentation
The CRUDlexUser API itself is documented here:
Upcoming bleeding edge:
Generated via (assuming APIGen is globally installed like composer global require ... and the PHP version is at maximum 7.1):
~/.composer/vendor/bin/apigen generate
Package
CRUDlexUser uses SemVer for versioning. Currently, the API changes quickly due to be < 1.0.0, so take care about notes in the changelog when upgrading.
Stable
"require": { "philiplb/crudlexuser": "0.14.0" }
Bleeding Edge
"require": { "philiplb/crudlexuser": "0.15.x-dev" }
Usage
This library offers two parts. First, a management interface for your admin panel to perform CRUD operations on your userbase and second, an symfony/security UserProvider offering in order to connect the users with the application.
The Admin Panel
The admin panel for your users is based on CRUDlex. So all you have to do is to add the needed entities to your crud.yml from the following sub chapters.
In order to get the salt generated and the password hashed, you have to let the library add some CRUDlex events in your initialization:
$crudUserSetup = new CRUDlex\UserSetup(); $crudUserSetup->addEvents($app['crud']->getData('user'));
Users
user: label: User table: user fields: username: type: text label: Username required: true unique: true password: type: text label: Password Hash description: 'Set this to your desired password. Will be automatically converted to an hash value not meant to be readable.' required: true salt: type: text label: Password Salt description: 'Auto populated field on user creation. Used internally.' required: false userRoles: type: many label: Roles many: entity: role nameField: role thisField: user thatField: role
Plus any more fields you need. Recommended for the password reset features:
email: type: text label: E-Mail required: true unique: true
Roles
role: label: Roles table: role fields: role: type: text label: Role required: true
Password Reset
In case you want to use the password reset features:
passwordReset: label: Password Resets table: password_reset fields: user: type: reference label: User reference: nameField: username entity: user required: true token: type: text label: Token required: true reset: type: datetime label: Reset
The UserProvider
Simply instantiate and add it to your symfony/security configuration:
$userProvider = new CRUDlex\UserProvider($app['crud']->getData('user'), $app['crud']->getData('userRole')); $app->register(new Silex\Provider\SecurityServiceProvider(), array( 'security.firewalls' => array( 'admin' => array( //... 'users' => $userProvider ), ), ));
Accessing Data of the Logged in User
In order to get the user data from the logged in user in your controller, you might grab him like this:
$user = $app['security.token_storage']->getToken()
You get back a CRUDlex\User instance having some getters, see the API docs.
Build Status
Code Quality
philiplb/crudlexuser 适用场景与选型建议
philiplb/crudlexuser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.22k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 09 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「silex」 「User management」 「security」 「crud」 「symfony security」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 philiplb/crudlexuser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 philiplb/crudlexuser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 philiplb/crudlexuser 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Object-oriented CRUD for Doctrine DBAL
Command bus implementation: Commands and domain events
Pomm service provider for the Silex µframwork.
A Silverstripe module to allow you to log into any of your Silverstripe sites from one place.
Payum offers everything you need to work with payments. From simplest use cases to very advanced ones.
Silex service provider for including FlexAuth library.
统计信息
- 总下载量: 2.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-18