1. Go to this page and download the library: Download artdevelopp/user-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
artdevelopp / user-bundle example snippets
artdevelopp_user:
#paramètre obligatoire:
mail_sender_address: '[email protected]'
#paramètre facultatif
user_register: true #enregistrement ouvert à tous/ Par defaut true
loginWith: 'email' #Par defaut email −> email ou username
user_class: 'App\Entity\User' #par défaut 'App\Entity\User'
confirm_email: true #envoi email confirmation / Par defaut true
role_admin: ROLE_ADMIN #par défaut ROLE_ADMIN
reset_role: false #remise du role par défaut après changement mot de passe −> true ou false / Par defaut: false
default_role: ROLE_USER #role par défaut ROLE_USER
// src/Entity/User.php
namespace App\Entity;
use App\Repository\UserRepository;
use ArtDevelopp\UserBundle\Model\User as ModelUser;
use ArtDevelopp\UserBundle\Model\UserInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[UniqueEntity('email')]
#[UniqueEntity('username')]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
use ModelUser;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
public function getUserIdentifier(): string
{
return $this->email; //Modifier l'attribut si besoin email ou username
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.