Download the PHP package damienharper/user-bundle without Composer
On this page you can find all versions of the php package damienharper/user-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download damienharper/user-bundle
More information about damienharper/user-bundle
Files in damienharper/user-bundle
Package user-bundle
Short Description User Bundle
License MIT
Informations about the package user-bundle
UserBundle
This bundle, simple yet convenient, lets you easily add to your application features such as:
- user authentication
- password resetting
- user account locking
- user account expiration
- force a user to reset his password at first connection
Notes:
- this bundle assumes you're using Doctrine to persist and retrieve your users. It provides a Doctrine UserProvider.
- if you need two factor authentication (2FA), this bundle plays nicely with TwoFactorBundle
- this bundle is inspired by FOSUserBundle
Installation
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
Applications that don't use Symfony Flex
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:
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
Configuration
Note: following configuration instructions target a Symfony 4 application.
Step 1: Configure the bundle
Create a file named dh_user.yaml
in the config/packages
directory with the following content.
Notes:
- By default, the bundle assumes your User class name is
App\Entity\User
Step 2: Setup routes
Edit the config/routes.yaml
file and add the following import rules.
Then, you'll have basic pages for logging in, requesting a password reset, resetting a password.
Step 3: Enable the bundle for your firewall
Edit the config/packages/security.yaml
file and add the appropriate blocks/rules as shown below, in this
minimal configuration example.
Step 4: Create (or update) your User class
The User class has to be an entity (the Doctrine way) which means a simple class containing properties mapped to columns of a table in the database.
Your User class has to implement a few interfaces to make it work with the bundle:
DH\UserBundle\Security\UserInterface
which lists the methods expected to be callable by the bundle\Serializable
regarding serialization/deserialization of User instances
In addition, a few properties are required by the bundle and as a convenience, the bundle provides you two traits you
can use
in your User class to minimize your work:
DH\UserBundle\Model\ExtendedUserTrait
contains all the properties and methods required by the bundle.DH\UserBundle\Model\UserTrait
only contains the minimal, it's up to you to implement the remaining required properties and methods (you can then use theExtendedUserTrait
as an example)
Example of a User class using ExtendedUserTrait
License
UserBundle is free to use and is licensed under the MIT license
All versions of user-bundle with dependencies
doctrine/orm Version ^2.7
symfony/form Version ^4.3|^5.0
symfony/framework-bundle Version ^4.3|^5.0
symfony/mailer Version ^4.3|^5.0
symfony/routing Version ^4.3|^5.0
symfony/security-bundle Version ^4.3|^5.0
symfony/twig-bundle Version ^4.3|^5.0
twig/twig Version ^3.0