aescarcha/user-bundle

用于 Symfony FOSUserBundle 的包装器

安装: 23

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

dev-master 2017-05-05 16:40 UTC

This package is auto-updated.

Last update: 2024-09-19 10:26:32 UTC


README

简介

此包是 FOS User Bundle 和 HWI oauth 的包装器,提供实体、存储库和 Facebook 支持。它还提供了用户 REST API。

REST API 需要 fractal 和 FosRestBundle

安装

composer require aescarcha/user-bundle

配置服务

config.yml
fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: Aescarcha\UserBundle\Entity\User
    profile:
        form:
            type: app_user_profile

hwi_oauth:
    connect:
        account_connector: my_user_provider
    # name of the firewall in which this bundle is active, this setting MUST be set
    firewall_name: secured_area
    fosub:
        username_iterations: 30
        properties:
            # these properties will be used/redefined later in the custom FOSUBUserProvider service.
            facebook: facebookId
    resource_owners:
        facebook:
            type:                facebook
            client_id:           Your-client-id
            client_secret:       your-client-secret
            infos_url:           "https://graph.facebook.com/me?fields=id,name,email,picture.type(square),birthday,locale,location,gender,first_name,last_name,link,timezone,verified"
            scope:               "email user_friends user_photos user_videos user_location user_about_me user_birthday basic_info"
            paths:
                locale:     locale
                birthday:   birthday
                location:   location.name     
                profilepicture: picture.data.url
services.yml
fos_user.doctrine_registry:
    alias: doctrine
my_user_provider:
    class: "%my_user_provider.class%"
    #this is the place where the properties are passed to the UserProvider - see config.yml
    arguments: [@fos_user.user_manager,{facebook: facebookId}]
AppKernel.php
    $bundles = array(
        new Aescarcha\UserBundle\AescarchaUserBundle(),
        new FOS\UserBundle\FOSUserBundle,
        new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
    );

测试

在仓库中提供了测试,但它们无法正常工作,因为测试需要一些实体和存储库来工作,使它们在干净的 symfony 安装中工作也是一个 TODO

待办事项

删除不需要的组件