TangoMan User Bundle
TangoMan User Bundle provides basis for user management., (*1)
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:, (*2)
$ composer require tangoman/user-bundle
This command requires you to have Composer installed globally, as explained
in the installation chapter
of the Composer documentation., (*3)
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:, (*4)
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
// ...
public function registerBundles()
{
$bundles = array(
// ...
new TangoMan\UserBundle\TangoManUserBundle(),
);
// ...
}
}
Enable UserBundle controllers by adding following code in the app/config/routing.yml file of your project., (*5)
tangoman_user:
resource: "@TangoManUserBundle/Controller/"
type: annotation
Enable UserBundle to handle user login/logout by adding following code in the app/config/security.yml file of your project., (*6)
security:
firewalls:
admin:
anonymous: ~
provider: database
pattern: ^/
form_login:
login_path: app_login
check_path: app_check
default_target_path: homepage
logout:
path: app_logout
target: homepage
invalidate_session: true
UserBundle need these settings to handle user registration, password reset emails., (*7)
Add following code in the app/config/parameters.yml file of your project., (*8)
parameters:
site_name: "FooBar"
site_author: "TangoMan"
mailer_from: "tangoman@localhost.dev"
Step 6: Update Twig Configuration
Enable twig to handle global variables by adding following code in the app/config/config.yml file of your project., (*9)
# Twig Configuration
twig:
globals:
site_name: "%site_name%"
site_author: "%site_author%"
mailer_from: "%mailer_from%"
Step 7: Create User entity
Your User entity must extend TangoMan\UserBundle\Model\User class., (*10)
Your User entity must implement getRoles() method., (*11)
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use TangoMan\UserBundle\Model\User as TangoManUser;
/**
* Class User
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
* @ORM\Table(name="user")
*/
class User extends TangoManUser
{
// ...
private $roles;
public function __construct()
{
parent::__construct();
// ...
}
public function getRoles()
{
return $this->roles;
}
}
Step 8: Base template
Your base template must be named as the following : base.html.twig, (*12)
Note
If you find any bug please report here : Issues, (*13)
License
Copyright (c) 2018 Matthias Morin, (*14)
Distributed under the MIT license., (*15)
If you like TangoMan User Bundle please star!
And follow me on GitHub: TangoMan75
... And check my other cool projects., (*16)
Matthias Morin | LinkedIn, (*17)