{"id":18907560,"url":"https://github.com/cesurapp/pd-user","last_synced_at":"2025-04-15T04:32:03.735Z","repository":{"id":52201677,"uuid":"134943214","full_name":"cesurapp/pd-user","owner":"cesurapp","description":"Simple user management system for Symfony 5.","archived":false,"fork":false,"pushed_at":"2021-06-03T21:36:18.000Z","size":157,"stargazers_count":24,"open_issues_count":9,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-01T18:07:00.751Z","etag":null,"topics":["authorization","php7","symfony","symfony4","user-management"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cesurapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"Security/SuperAdminVoter.php","support":null}},"created_at":"2018-05-26T08:24:33.000Z","updated_at":"2024-01-10T20:30:11.000Z","dependencies_parsed_at":"2022-09-07T05:41:12.040Z","dependency_job_id":null,"html_url":"https://github.com/cesurapp/pd-user","commit_stats":null,"previous_names":["cesurapp/pd-user","arrrray/pd-user"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cesurapp%2Fpd-user","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cesurapp%2Fpd-user/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cesurapp%2Fpd-user/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cesurapp%2Fpd-user/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cesurapp","download_url":"https://codeload.github.com/cesurapp/pd-user/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249006527,"owners_count":21197290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authorization","php7","symfony","symfony4","user-management"],"created_at":"2024-11-08T09:22:09.619Z","updated_at":"2025-04-15T04:32:02.910Z","avatar_url":"https://github.com/cesurapp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pdUser Bundle\nSimple user management system for Symfony 5+.\n\n[![Packagist](https://img.shields.io/packagist/dt/appaydin/pd-user.svg)](https://github.com/appaydin/pd-user)\n[![Github Release](https://img.shields.io/github/release/appaydin/pd-user.svg)](https://github.com/appaydin/pd-user)\n[![license](https://img.shields.io/github/license/appaydin/pd-user.svg)](https://github.com/appaydin/pd-user)\n[![PHP from Packagist](https://img.shields.io/packagist/php-v/appaydin/pd-user.svg)](https://github.com/appaydin/pd-user)\n\nInstallation\n---\n\n### Step 1: Download the Bundle\n\nOpen a command console, enter your project directory and execute the\nfollowing command to download the latest stable version of this bundle:\n\n```console\n$ composer require appaydin/pd-user\n```\n\nThis command requires you to have Composer installed globally, as explained\nin the [installation chapter](https://getcomposer.org/doc/00-intro.md)\nof the Composer documentation.\n\n### Step 2: Enable the Bundle\n\nWith Symfony 5, the package will be activated automatically. But if something goes wrong, you can install it manually.\n\nThen, enable the bundle by adding it to the list of registered bundles\nin the `config/bundles.php` file of your project:\n\n```php\n\u003c?php\n// config/bundles.php\n\nreturn [\n    //...\n    Pd\\UserBundle\\PdUserBundle::class =\u003e ['all' =\u003e true]\n];\n```\n\n### Step 3: Create User, Group, Class\n##### A) Create User Class\nCreate the User class for your application. This class can look and act however you want: add any properties or methods you find useful. This is your User class.\n```php\n\u003c?php\n// src/Entity/User.php\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Symfony\\Bridge\\Doctrine\\Validator\\Constraints\\UniqueEntity;\nuse Pd\\UserBundle\\Model\\User as BaseUser;\n\n/**\n * @ORM\\Table(name=\"user\")\n * @ORM\\Entity\n * @UniqueEntity(fields=\"email\", message=\"email_already_taken\")\n */\nclass User extends BaseUser\n{\n    public function __construct()\n    {\n        parent::__construct();\n    }\n}\n```\n\n##### B) Create Group Class\nCreate the Group class for your application. This class creates user groups.\n```php\n\u003c?php\n// src/Entity/Group.php\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Symfony\\Bridge\\Doctrine\\Validator\\Constraints\\UniqueEntity;\nuse Pd\\UserBundle\\Model\\Group as BaseGroup;\n\n/**\n * @ORM\\Table(name=\"user_group\")\n * @ORM\\Entity\n * @UniqueEntity(fields=\"name\", message=\"group_already_taken\")\n */\nclass Group extends BaseGroup\n{\n\n}\n```\n\n### Step 4: Settings Bundle\nCreate a \"user.yaml\" file for the settings.\n```yaml\n# config/packages/user.yaml\n\npd_user:\n    user_class: App\\Entity\\User\n    group_class: App\\Entity\\Group\n    default_group: ''\n    login_redirect: 'web_home'\n    email_confirmation: true\n    welcome_email: true\n    user_registration: true\n    #template_path: '@Admin/Auth'\n    resetting_request_time: 7200\n    mail_sender_address: 'example@example.com'\n    mail_sender_name: 'pdUser'\n    active_language: ['en', 'tr']\n    register_type: ''\n    resetting_type: ''\n\n```\n* __user_class:__ Define 'User' class address\n* __group_class:__ Define 'Group' class address\n* __default_group:__ New members will join group id\n* __login_redirect:__ The router name to which logged-in users will be directed.\n* __email_confirmation:__ Enables email verification for register.\n* __welcome_email:__ Welcome new members welcome message.\n* __user_registration:__ Enable/Disable user registration.\n* __template_path:__ Directory for Twig templates. Changes can be made by copying the source directory.\n* __resetting_request_time:__ Enter the retry time in seconds for password renewal.\n* __mail_sender_address:__ Mail sender address\n* __mail_sender_name:__ Mail sender name\n* __active_language:__ List of Active Language\n* __register_type:__ Register Form Type\n* __resetting_type:__ Resetting Form Type\n\n####Events\n    UserEvent::REGISTER_BEFORE =\u003e It is launched before the registration form.\n    UserEvent::REGISTER =\u003e When the recording is complete, it is launched.\n    UserEvent::REGISTER_CONFIRM =\u003e E-mail is launched when registration is confirmed.\n    UserEvent::RESETTING =\u003e The password is launched when the reset mail is sent.\n    UserEvent::RESETTING_COMPLETE =\u003e It is launched when the password is changed.\n\n### Step 5: Configure Your Application's Security.yml\nBelow is a minimal example of the configuration necessary to use the pdUser in your application:\n```yaml\n# config/packages/security.yaml\n\nsecurity:\n    enable_authenticator_manager: true\n    password_hashers:\n        App\\Entity\\User:\n            algorithm: auto\n    role_hierarchy:\n        ROLE_ADMIN: [ROLE_USER]\n    providers:\n        pdadmin_auth:\n            entity:\n                class: App\\Entity\\User\n                property: email\n    firewalls:\n        # Enable for Development\n        dev:\n            pattern: ^/(_(profiler|wdt)|css|images|js)/\n            security: false\n        main:\n            pattern:    ^/\n            provider: pdadmin_auth\n            lazy: true\n            user_checker: Pd\\UserBundle\\Security\\UserChecker\n            switch_user: true\n            http_basic: ~\n            entry_point: form_login\n            form_login:\n                use_referer: true\n                login_path: security_login\n                check_path: security_login\n                #default_target_path: 'dashboard' # Login Redirect Path\n            logout:\n                path: security_logout\n                #target: 'home' # Logout Redirect Path\n            remember_me:\n                secret:   '%env(APP_SECRET)%'\n                #lifetime: 604800\n                path:     /\n    access_control:\n        - { path: ^/auth/login$, role: PUBLIC_ACCESS }\n        - { path: ^/auth/register, role: PUBLIC_ACCESS }\n        - { path: ^/auth/resetting, role: PUBLIC_ACCESS }\n        #- { path: '^/', role: ROLE_ADMIN }\n```\n\n### Step 6: Import pdUser Routing\nNow that you have activated and configured the bundle, all that is left to do is import the pdUser routing files.\n\nBy importing the routing files you will have ready made pages for things such as logging in, register, password resetting.\n```yaml\n#config/routes.yaml\n\nauthorization:\n    resource: \"@PdUserBundle/Resources/config/routing.yaml\"\n    prefix: 'auth'\n```\n\n### Step 6: Update Your Database Schema\nAll steps are completed. You can now update the database schema.\n```yaml\nphp bin/console doctrine:schema:update --force\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcesurapp%2Fpd-user","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcesurapp%2Fpd-user","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcesurapp%2Fpd-user/lists"}