Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cesurapp/pd-user
Simple user management system for Symfony 5.
https://github.com/cesurapp/pd-user
authorization php7 symfony symfony4 user-management
Last synced: 7 days ago
JSON representation
Simple user management system for Symfony 5.
- Host: GitHub
- URL: https://github.com/cesurapp/pd-user
- Owner: cesurapp
- License: mit
- Created: 2018-05-26T08:24:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-03T21:36:18.000Z (over 3 years ago)
- Last Synced: 2024-09-25T21:56:39.911Z (about 2 months ago)
- Topics: authorization, php7, symfony, symfony4, user-management
- Language: PHP
- Homepage:
- Size: 153 KB
- Stars: 24
- Watchers: 3
- Forks: 5
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: Security/SuperAdminVoter.php
Awesome Lists containing this project
README
# pdUser Bundle
Simple user management system for Symfony 5+.[![Packagist](https://img.shields.io/packagist/dt/appaydin/pd-user.svg)](https://github.com/appaydin/pd-user)
[![Github Release](https://img.shields.io/github/release/appaydin/pd-user.svg)](https://github.com/appaydin/pd-user)
[![license](https://img.shields.io/github/license/appaydin/pd-user.svg)](https://github.com/appaydin/pd-user)
[![PHP from Packagist](https://img.shields.io/packagist/php-v/appaydin/pd-user.svg)](https://github.com/appaydin/pd-user)Installation
---### Step 1: Download the Bundle
Open a command console, enter your project directory and execute the
following command to download the latest stable version of this bundle:```console
$ composer require appaydin/pd-user
```This command requires you to have Composer installed globally, as explained
in the [installation chapter](https://getcomposer.org/doc/00-intro.md)
of the Composer documentation.### Step 2: Enable the Bundle
With Symfony 5, the package will be activated automatically. But if something goes wrong, you can install it manually.
Then, enable the bundle by adding it to the list of registered bundles
in the `config/bundles.php` file of your project:```php
['all' => true]
];
```### Step 3: Create User, Group, Class
##### A) Create User Class
Create 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.
```php
It is launched before the registration form.
UserEvent::REGISTER => When the recording is complete, it is launched.
UserEvent::REGISTER_CONFIRM => E-mail is launched when registration is confirmed.
UserEvent::RESETTING => The password is launched when the reset mail is sent.
UserEvent::RESETTING_COMPLETE => It is launched when the password is changed.### Step 5: Configure Your Application's Security.yml
Below is a minimal example of the configuration necessary to use the pdUser in your application:
```yaml
# config/packages/security.yamlsecurity:
enable_authenticator_manager: true
password_hashers:
App\Entity\User:
algorithm: auto
role_hierarchy:
ROLE_ADMIN: [ROLE_USER]
providers:
pdadmin_auth:
entity:
class: App\Entity\User
property: email
firewalls:
# Enable for Development
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
provider: pdadmin_auth
lazy: true
user_checker: Pd\UserBundle\Security\UserChecker
switch_user: true
http_basic: ~
entry_point: form_login
form_login:
use_referer: true
login_path: security_login
check_path: security_login
#default_target_path: 'dashboard' # Login Redirect Path
logout:
path: security_logout
#target: 'home' # Logout Redirect Path
remember_me:
secret: '%env(APP_SECRET)%'
#lifetime: 604800
path: /
access_control:
- { path: ^/auth/login$, role: PUBLIC_ACCESS }
- { path: ^/auth/register, role: PUBLIC_ACCESS }
- { path: ^/auth/resetting, role: PUBLIC_ACCESS }
#- { path: '^/', role: ROLE_ADMIN }
```### Step 6: Import pdUser Routing
Now that you have activated and configured the bundle, all that is left to do is import the pdUser routing files.By importing the routing files you will have ready made pages for things such as logging in, register, password resetting.
```yaml
#config/routes.yamlauthorization:
resource: "@PdUserBundle/Resources/config/routing.yaml"
prefix: 'auth'
```### Step 6: Update Your Database Schema
All steps are completed. You can now update the database schema.
```yaml
php bin/console doctrine:schema:update --force
```