承接 lirriella/yii2-users 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lirriella/yii2-users

Composer 安装命令:

composer require lirriella/yii2-users

包简介

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

README 文档

README

Module for management users and their rights with the support of registration via social services and assigned to each user more than one social service.

Abilities

User registration and authorization by e-mail and via social networks with the ability to bind several different social networking accounts to a one account on the your site

Authorization widget OAuth keys manage widget

Changing password

Changing password

Recovering password

Recovering password

Changing e-mail. Confirmation will be sent to the old and new address

Changing e-mai

Editinig profile

Editinig profile

Administation module for manage users

Admin module

Editing RBAC structure and user rights via the GUI

Editing RBAC structure

Editiong user permissions

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist lirriella/yii2-users "*"

or add

"lirriella/yii2-users": "*"

to the require section of your composer.json file.

Config

'user' => [
    'identityClass' => 'lirriella\users\models\User',
    'enableAutoLogin' => true,
    'loginUrl' => ['/login'],
],
'authClientCollection' => [
    'class' => 'yii\authclient\Collection',
    'clients' => [
        'vkontakte' => [
            'class' => 'budyaga\users\components\oauth\VKontakte',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
            'scope' => 'email'
        ],
        'google' => [
            'class' => 'lirriella\users\components\oauth\Google',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'facebook' => [
            'class' => 'budyaga\users\components\oauth\Facebook',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'github' => [
            'class' => 'budyaga\users\components\oauth\GitHub',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
            'scope' => 'user:email, user'
        ],
        'linkedin' => [
            'class' => 'budyaga\users\components\oauth\LinkedIn',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'live' => [
            'class' => 'budyaga\users\components\oauth\Live',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'yandex' => [
            'class' => 'budyaga\users\components\oauth\Yandex',
            'clientId' => 'XXX',
            'clientSecret' => 'XXX',
        ],
        'twitter' => [
            'class' => 'budyaga\users\components\oauth\Twitter',
            'consumerKey' => 'XXX',
            'consumerSecret' => 'XXX',
        ],
    ],
],
'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'rules' => [
        '/signup' => '/user/user/signup',
        '/login' => '/user/user/login',
        '/logout' => '/user/user/logout',
        '/requestPasswordReset' => '/user/user/request-password-reset',
        '/resetPassword' => '/user/user/reset-password',
        '/profile' => '/user/user/profile',
        '/retryConfirmEmail' => '/user/user/retry-confirm-email',
        '/confirmEmail' => '/user/user/confirm-email',
        '/unbind/<id:[\w\-]+>' => '/user/auth/unbind',
        '/oauth/<authclient:[\w\-]+>' => '/user/auth/index'
    ],
],
'authManager' => [
    'class' => 'yii\rbac\DbManager',
],

'modules' => [
    'user' => [
        'class' => 'budyaga\users\Module',
        'userPhotoUrl' => 'http://example.com/uploads/user/photo',
        'userPhotoPath' => '@frontend/web/uploads/user/photo'
    ],
],

Instead of XXX, you have to use yours values. To receive them, you must create applications on the social networks.

Client Registration address
vkontakte https://vk.com/editapp?act=create
google https://console.developers.google.com/project
facebook https://developers.facebook.com/apps
github https://github.com/settings/applications/new
linkedin https://www.linkedin.com/secure/developer
live https://account.live.com/developers/applications
yandex https://oauth.yandex.ru/client/new
twitter https://dev.twitter.com/apps/new

If you are using advanced template and Yandex client, then you have to add authClientCollection in configurations for frontend and backend applications. However Yandex client should be added to only one of the applications. The reason for this is that Yandex one application can work with only one domain, you can not add two different Callback URL on different domains.

Not all services returns all user data. Some of the data get the default settings, if the service does not return them.

Database migrations

yii migrate/up --migrationPath=@vendor/lirriella/yii2-users/migrations

This migration create all necessary for the operation of the module tables and two users:

E-mail Password
administrator@example.com administrator@example.com
moderator@example.com moderator@example.com

Usage

in main layout:

use lirriella\users\components\AuthorizationWidget;
<?= AuthorizationWidget::widget() ?>

Signup: http://example.com/signup

Profile: http://example.com/profile

Restore password: http://example.com/requestPasswordReset

Manage users: http://example.com/user/admin

Manage RBAC: http://example.com/user/rbac

Custom views and email templates

If you want use custom views and email templates you can override their in config. For example:

'modules' => [
    'user' => [
        'class' => 'lirriella\users\Module',
        'customViews' => [
            'login' => '@app/views/site/login'
        ],
        'customMailViews' => [
            'confirmChangeEmail' => '@app/mail/confirmChangeEmail' //in this case you have to create files confirmChangeEmail-html.php and confirmChangeEmail-text.php in mail folder
        ]
    ],
],

You can override all views from vendor\lirriella\yii2-users\views\user and vendor\lirriella\yii2-users\mail folders.

lirriella/yii2-users 适用场景与选型建议

lirriella/yii2-users 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「oauth」 「module」 「extension」 「Users」 「rbac」 「yii2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 lirriella/yii2-users 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 lirriella/yii2-users 我们能提供哪些服务?
定制开发 / 二次开发

基于 lirriella/yii2-users 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 37
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-02-23