This is a quick Howto about how to set up a new symfony project. There will be only a minimal description of why. If you want to know more details, you should have a look at the very good tutorial symblog, which I used for inspiration of this post.
Setup project
- Use PHP Composer to download symfony2 without vendors.
- Enter the project directory
- Install vendors
Create Symfony structure
mkdir bin cd bin curl -s https://getcomposer.org/installer | php php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/<project name> 2.1.7 cp composer.phar <project name>/ cd <project name>
Prepare symfony
Remove files:
rm -rf app/cache/* rm -rf app/logs/*
Make directories writeable for the server…
- On Systems with ACLs supporting chmod +a
sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
- On Systems with ACLs not supporting chmod +a (Ubuntu until 12.04)
sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
- On Systems without ACLs
umask(0002); // This will let the permissions be 0775 // or umask(0000); // This will let the permissions be 0777 // or similar
Setup git
Prepare special files for git
cp app/config/parameters.yml app/config/parameters.yml.dist cp app/phpunit.xml.dist app/phpunit.xml
Create .gitignore file
# This is a ignore file for git web/bundles/ app/bootstrap.php.cache app/cache/* app/logs/* build/ vendor app/config/parameters.yml app/phpunit.xml
Initialize git repository
git init git add . git commit -m "Initial commit"
Install/Update vendors
Install standard vendors
php composer.phar install
You most likely want to install these additional vendor packages:
Therefore add the following lines to the file composer.json
{
"require": {
[...]
"doctrine/doctrine-fixtures-bundle": "dev-master",
"doctrine/data-fixtures": "dev-master",
"doctrine/migrations": "dev-master",
"doctrine/doctrine-migrations-bundle": "dev-master"
}
}
Run
php composer.phar update
Add the following lines to the file. Pay attention to the order!
app/AppKernel.php
...
$bundles = array(
...
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
...
Apply changes to git
git commit -m "Added additional vendors"
Bundle details
- Create bundle
- Clean-up new bundle
php app/console generate:bundle --namespace=<company>/Bundle/<bundlename>Bundle --format=yml
find src/ -iname "*default*" -exec rm -rf {} \;
Layout concept
For Symfony we use a three level inheritance layout as a best practise. It consists of a base layout, which is mostly located in the app/Resources/views/ directory, the second level as a bundle layout and the third for the actual page.
Base layout
<!-- app/Resources/views/base.html.twig -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset=utf-8" />
<title>{% block title %}hompage title here{% endblock %} - homepage</title>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
{% block stylesheets %}
<link href='http://fonts.googleapis.com/css?family=Irish+Grover' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=La+Belle+Aurore' rel='stylesheet' type='text/css'>
{% stylesheets
'css/*'
output='css/combined/base.css'
filter='?yui_css'
%}
<link href="{{ asset_url }}" rel="stylesheet" media="screen" />
{% endstylesheets %}
{% endblock %}
{% block javascript %}
{% javascripts
'js/*'
output='js/compiled/base.js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
<link rel="shortcut icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
<section id="wrapper">
<header id="header">
<div class="top">
{% block topnavigation %}
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
{% endblock %}
</div>
<hgroup>
<h2>{% block hompage_title %}<a href="#">Homepage name</a>{% endblock %}</h2>
<h3>{% block homepage_tagline %}<a href="#">Homepage tagline</a>{% endblock %}</h3>
</hgroup>
</header>
<!-- Three column page style -->
<aside class="navbar">
{% block navbar %}{% endblock %}
</aside>
<section class="main-col">
{% block body %}{% endblock %}
</section>
<aside class="sidebar">
{% block sidebar %}{% endblock %}
</aside>
<div id="footer">
{% block footer %}
Here is the place for the footer.
{% endblock %}
</div>
</section>
{% block javascripts %}{% endblock %}
</body>
</html>
Bundle Layout
{# src/Uniquename/BundlenameBundle/Resources/views/layout.html.twig #}
{% extends '::base.html.twig' %}
{% block stylesheets %}
{{ parent() }}
{% stylesheets
'@BundlenameBundle/Resources/public/css/*'
output='css/combined/bundlename.css'
filter='?yui_css'
%}
<link href="{{ asset_url }}" rel="stylesheet" media="screen" />
{% endstylesheets %}
{% block javascript %}
{% javascripts
'@BundlenameBundle/Resources/public/js/*'
output='js/compiled/bundlename.js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
{% endblock %}
{% block sidebar %}
{# render "BundlenameBundle:Page:sidebar" #}
{% endblock %}
Page Layout
{# src/Uniquename/BundlenameBundle/Resources/views/Page/about.html.twig #}
{% extends 'BundlenameBundle::layout.html.twig' %}
{% block title %}About{% endblock%}
{% block body %}
<header>
<h1>About hompage name</h1>
</header>
<article>
<p>Donec imperdiet ante sed diam consequat et dictum erat faucibus. Aliquam sit
amet vehicula leo.</p>
</article>
{% endblock %}
In the CSS and JS sections we used some filters. Therefore we have to install and edit some other things:
Download YUI compressor and save it at the right place
Edit app/config/config.yml
# app/config/config.yml
# ..
assetic:
filters:
yui_css:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar
# ..
For Productive Environment
Every time we change the assets, eg. css, js or image files, we have to execute the following commands to active/regenerate them:
rm -f web/css/combined/* rm -f web/js/compiled/* app/console --env=prod assetic:dump
Entities / Database
Setup database
- Change the variables in app/config/parameters.ini
- Create Database
- Create Schema
app/console doctrine:database:create app/console doctrine:schema:create
After DB-Table changes
app/console doctrine:migrations:diff app/console doctrine:migrations:migrate
Creating an Entity
app/console doctrine:generate:entity --entity="UniquenameBundlenameBundle:Entityname" \ --fields="uniquetitle:string title:string year:smallint releasetype:string(8) \ titlelang:string(3) runtime:smallint imdbnumber:string(7) image:string(20) \ created:datetime updated:datetime
Add LifeCycleCallbacks
- Entity/Entityname.php
...
// @ORM\HasLifecycleCallbacks()
class ...
{ ...
public function __construct()
{
$this->setCreated(new \DateTime());
$this->setUpdated(new \DateTime());
}
/**
* @ORM\PreUpdate
*/
public function setUpdatedValue()
{
$this->setUpdated(new \DateTime());
}
// ..
After any change in this class you need to run:
app/console doctrine:generate:entities Uniquename
Creating Fixtures
Special Bundles
FOS UserBundle
Using this Bundle is not too hard, at least when you stick to certain rules in the beginning. Best practise is to extend the FOSUSERBundle by your own UserBundle. This way you have no problem to change the default/implemented behaviour of the FOS bundle. It was a little bit hard to figure out the way to set the bundle up, but the mix from these three sites did the thing. Both Tutorials did not exactly work as they described.
Here I describe the way for ORM.
Create UserBundle
- Generate own UserBundle, which will extend the FOSUserBundle
- Generate User entity
app/console generate:bundle --namespace=Uniquename/UserBundle --format=yml app/console doctrine:generate:entity --entity="UniquenameUserBundle:User" --fields=""
Install FOSUserBundle
Add the following lines in your deps file:
[FOSUserBundle] git=git://github.com/FriendsOfSymfony/FOSUserBundle.git target=bundles/FOS/UserBundle
Download and install bundle
bin/vendors instal
Add the FOS namespace to your autoloader:
<?php
// app/autoload.php
$loader->registerNamespaces(array(
// ...
'FOS' => __DIR__.'/../vendor/bundles',
));
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new FOS\UserBundle\FOSUserBundle(),
);
}
Change UniquenameUserBundle
Update src/Uniquename/UserBundle/UniquenameUserBundle.php and add a getParent() method as illustrated below:
namespace Uniquename\UserBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class UniquenameUserBundle extends Bundle
{
public function getParent()
{
return 'FOSUserBundle';
}
}
Change User.php in the Uniquename/UserBundle
<?php
// src/Uniquename/UserBundle/Entity/User.php
namespace Uniquename\UserBundle\Entity;
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct()
{
parent::__construct();
// your own logic
}
}
User is a reserved keyword in SQL so you cannot use it as table name.
Configuring Security+
The following are the minimal settings for the security setup of Symfony using the FOSUserBundle:
# app/config/security.yml
security:
providers:
fos_userbundle:
id: fos_user.user_manager
encoders:
"FOS\UserBundle\Model\UserInterface": sha512
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
# app/config/config.yml
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: Uniquename\UserBundle\Entity\User
# src/Uniquename/UserBundle/Resources/config/routing.yml
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
For Email functionallity you need to configure the SwiftmailerBundle.
SwiftmailerBundle
Configuration
# app/config/parameters.ini mailer_transport = "smtp" mailer_host = "localhost" mailer_user = "" mailer_password = ""
# app/config/config_test.yml
swiftmailer:
disable_delivery: true
# app/config/config_dev.yml
swiftmailer:
disable_delivery: true
The following configuration intercepts the sending process so you can check the email to be send.
# app/config/config_dev.yml web_profiler: ... intercept_redirects: true
This is a quick Howto about how to set up a new symfony project. There will be only a minimal description of why. If you want to know more details, you should have a look at the very good tutorial symblog, which I used for inspiration of this post.
Setup project
Use PHP Composer to download symfony2 without vendors.
Enter the project directory
Install vendors
Create Symfony structure
mkdir bin
cd bin
curl -s https://getcomposer.org/installer | php
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.1.2
mv Symfony <projectname>
cp composer.phar <projectname>/
cd <projectname>
Prepare symfony
Remove files:
rm -rf app/cache/*
rm -rf app/logs/*
Make directories writeable for the server…
On Systems with ACLs supporting chmod +a
sudo chmod +a “www-data allow delete,write,append,file_inherit,directory_inherit” app/cache app/logs
sudo chmod +a “`whoami` allow delete,write,append,file_inherit,directory_inherit” app/cache app/logs
On Systems with ACLs not supporting chmod +a (Ubuntu until 12.04)
sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
On Systems without ACLs
umask(0002); // This will let the permissions be 0775
// or
umask(0000); // This will let the permissions be 0777
// or similar
Setup git
Prepare special files for git
cp app/config/parameters.yml app/config/parameters.yml.dist cp app/phpunit.xml.dist app/phpunit.xml
Create .gitignore file
# This is a ignore file for git
web/bundles/
app/bootstrap.php.cache
app/cache/*
app/logs/*
build/
vendor
app/config/parameters.yml
app/phpunit.xml
Initialize git repository
git init
git add .
git commit -m “Initial commit”
Install/Update vendors
Install standard vendors
php composer.phar install
You most likely want to install these additional vendor packages:
Therefore add the following lines to the file deps
[doctrine-fixtures]
git=http://github.com/doctrine/data-fixtures.git
[DoctrineFixturesBundle]
git=http://github.com/symfony/DoctrineFixturesBundle.git
target=/bundles/Symfony/Bundle/DoctrineFixturesBundle
[doctrine-migrations]
git=http://github.com/doctrine/migrations.git
[DoctrineMigrationsBundle]
git=http://github.com/symfony/DoctrineMigrationsBundle.git
target=/bundles/Symfony/Bundle/DoctrineMigrationsBundle
Run
bin/vendors install
Add the following lines to the file. Pay attention to the order!
app/autoloader.php
…
$loader->registerNamespaces(array(
…
‘Doctrine\\Common\\DataFixtures’ => __DIR__.’/../vendor/doctrine-fixtures/lib’,
‘Doctrine\\Common’ => __DIR__.’/../vendor/doctrine-common/lib’,
‘Doctrine\\DBAL\\Migrations’ => __DIR__.’/../vendor/doctrine-migrations/lib’,
‘Doctrine\\DBAL’ => __DIR__.’/../vendor/doctrine-dbal/lib’,
…
app/AppKernel.php
…
$bundles = array(
…
new Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle(),
new Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle(),
…
Apply changes to git
git commit -m “Added additional vendors”
Bundle details
Create bundle
Clean-up new bundle
app/console generate:bundle –namespace=<company>/<bundlename>Bundle –format=yml
find src/ -iname “*default*” -exec rm -rf {} \;
Layout concept
For Symfony we use a three level inheritance layout as a best practise. It consists of a base layout, which is mostly located in the app/Resources/views/ directory, the second level as a bundle layout and the third for the actual page.
Base layout
<!– app/Resources/views/base.html.twig –>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html”; charset=utf-8″ />
<title>{% block title %}hompage title here{% endblock %} – homepage</title>
<!–[if lt IE 9]>
<script src=”http://html5shim.googlecode.com/svn/trunk/html5.js”></script>
<![endif]–>
{% block stylesheets %}
<link href=’http://fonts.googleapis.com/css?family=Irish+Grover’ rel=’stylesheet’ type=’text/css’>
<link href=’http://fonts.googleapis.com/css?family=La+Belle+Aurore’ rel=’stylesheet’ type=’text/css’>
{% stylesheets
‘css/*’
output=’css/combined/base.css’
filter=’?yui_css’
%}
<link href=”{{ asset_url }}” rel=”stylesheet” media=”screen” />
{% endstylesheets %}
{% endblock %}
{% block javascript %}
{% javascripts
‘js/*’
output=’js/compiled/base.js’
%}
<script type=”text/javascript” src=”{{ asset_url }}”></script>
{% endjavascripts %}
{% endblock %}
<link rel=”shortcut icon” href=”{{ asset(‘favicon.ico’) }}” />
</head>
<body>
<section id=”wrapper”>
<header id=”header”>
<div class=”top”>
{% block topnavigation %}
<nav>
<ul>
<li><a href=”#”>Home</a></li>
<li><a href=”#”>About</a></li>
<li><a href=”#”>Contact</a></li>
</ul>
</nav>
{% endblock %}
</div>
<hgroup>
<h2>{% block hompage_title %}<a href=”#”>Homepage name</a>{% endblock %}</h2>
<h3>{% block homepage_tagline %}<a href=”#”>Homepage tagline</a>{% endblock %}</h3>
</hgroup>
</header>
<!– Three column page style –>
<aside class=”navbar”>
{% block navbar %}{% endblock %}
</aside>
<section class=”main-col”>
{% block body %}{% endblock %}
</section>
<aside class=”sidebar”>
{% block sidebar %}{% endblock %}
</aside>
<div id=”footer”>
{% block footer %}
Here is the place for the footer.
{% endblock %}
</div>
</section>
{% block javascripts %}{% endblock %}
</body>
</html>
Bundle Layout
{# src/Uniquename/BundlenameBundle/Resources/views/layout.html.twig #}
{% extends ‘::base.html.twig’ %}
{% block stylesheets %}
{{ parent() }}
{% stylesheets
‘@BundlenameBundle/Resources/public/css/*’
output=’css/combined/bundlename.css’
filter=’?yui_css’
%}
<link href=”{{ asset_url }}” rel=”stylesheet” media=”screen” />
{% endstylesheets %}
{% block javascript %}
{% javascripts
‘@BundlenameBundle/Resources/public/js/*’
output=’js/compiled/bundlename.js’
%}
<script type=”text/javascript” src=”{{ asset_url }}”></script>
{% endjavascripts %}
{% endblock %}
{% endblock %}
{% block sidebar %}
{# render “BundlenameBundle:Page:sidebar” #}
{% endblock %}
Page Layout
{# src/Uniquename/BundlenameBundle/Resources/views/Page/about.html.twig #}
{% extends ‘BundlenameBundle::layout.html.twig’ %}
{% block title %}About{% endblock%}
{% block body %}
<header>
<h1>About hompage name</h1>
</header>
<article>
<p>Donec imperdiet ante sed diam consequat et dictum erat faucibus. Aliquam sit
amet vehicula leo.</p>
</article>
{% endblock %}
In the CSS and JS sections we used some filters. Therefore we have to install and edit some other things:
Download YUI compressor and save it at the right place
Edit app/config/config.yml
# app/config/config.yml
# ..
assetic:
filters:
yui_css:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar
# ..
For Productive Environment
Every time we change the assets, eg. css, js or image files, we have to execute the following commands to active/regenerate them:
rm -f web/css/combined/*
rm -f web/js/compiled/*
app/console –env=prod assetic:dump
Entities / Database
Setup database
Change the variables in app/config/parameters.ini
Create Database
Create Schema
app/console doctrine:database:create
app/console doctrine:schema:create
After DB-Table changes
app/console doctrine:migrations:diff
app/console doctrine:migrations:migrate
Creating an Entity
app/console doctrine:generate:entity –entity=”UniquenameBundlenameBundle:Entityname” –fields=”uniquetitle:string title:string year:smallint releasetype:string(8) titlelang:string(3) runtime:smallint imdbnumber:string(7) image:string(20) created:datetime updated:datetime
Add LifeCycleCallbacks
Entity/Entityname.php
…
// @ORM\HasLifecycleCallbacks()
class …
{ …
public function __construct()
{
$this->setCreated(new \DateTime());
$this->setUpdated(new \DateTime());
}
/**
* @ORM\preUpdate
*/
public function setUpdatedValue()
{
$this->setUpdated(new \DateTime());
}
// ..
After any change in this class you need to run:
app/console doctrine:generate:entities Uniquename
Creating Fixtures
Special Bundles
FOS UserBundle
Using this Bundle is not too hard, at least when you stick to certain rules in the beginning. Best practise is to extend the FOSUSERBundle by your own UserBundle. This way you have no problem to change the default/implemented behaviour of the FOS bundle. It was a little bit hard to figure out the way to set the bundle up, but the mix from these three sites did the thing. Both Tutorials did not exactly work as they described.
Here I describe the way for ORM.
Create UserBundle
Generate own UserBundle, which will extend the FOSUserBundle
Generate User entity
app/console generate:bundle –namespace=Uniquename/UserBundle –format=yml
app/console doctrine:generate:entity –entity=”UniquenameUserBundle:User” –fields=””
Install FOSUserBundle
Add the following lines in your deps file:
[FOSUserBundle] git=git://github.com/FriendsOfSymfony/FOSUserBundle.git target=bundles/FOS/UserBundle
Download and install bundle
bin/vendors instal
Add the FOS namespace to your autoloader:
<?php
// app/autoload.php
$loader->registerNamespaces(array(
// …
‘FOS’ => __DIR__.’/../vendor/bundles’,
));
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// …
new FOS\UserBundle\FOSUserBundle(),
);
}
Change UniquenameUserBundle
Update src/Uniquename/UserBundle/UniquenameUserBundle.php and add a getParent() method as illustrated below:
namespace Uniquename\UserBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class UniquenameUserBundle extends Bundle
{
public function getParent()
{
return ‘FOSUserBundle’;
}
}
Change User.php in the Uniquename/UserBundle
<?php
// src/Uniquename/UserBundle/Entity/User.php
namespace Uniquename\UserBundle\Entity;
use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name=”fos_user”)
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type=”integer”)
* @ORM\GeneratedValue(strategy=”AUTO”)
*/
protected $id;
public function __construct()
{
parent::__construct();
// your own logic
}
}
User is a reserved keyword in SQL so you cannot use it as table name.
Configuring Security+
The following are the minimal settings for the security setup of Symfony using the FOSUserBundle:
# app/config/security.yml
security:
providers:
fos_userbundle:
id: fos_user.user_manager
encoders:
“FOS\UserBundle\Model\UserInterface”: sha512
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
– { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
– { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
– { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
– { path: ^/admin/, role: ROLE_ADMIN }
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
# app/config/config.yml
fos_user:
db_driver: orm # other valid values are ‘mongodb’, ‘couchdb’ and ‘propel’
firewall_name: main
user_class: Uniquename\UserBundle\Entity\User
# src/Uniquename/UserBundle/Resources/config/routing.yml
fos_user_security:
resource: “@FOSUserBundle/Resources/config/routing/security.xml”
fos_user_profile:
resource: “@FOSUserBundle/Resources/config/routing/profile.xml”
prefix: /profile
fos_user_register:
resource: “@FOSUserBundle/Resources/config/routing/registration.xml”
prefix: /register
fos_user_resetting:
resource: “@FOSUserBundle/Resources/config/routing/resetting.xml”
prefix: /resetting
fos_user_change_password:
resource: “@FOSUserBundle/Resources/config/routing/change_password.xml”
prefix: /profile
For Email functionallity you need to configure the SwiftmailerBundle.
SwiftmailerBundle
Configuration
# app/config/parameters.ini
mailer_transport = “smtp”
mailer_host = “localhost”
mailer_user = “”
mailer_password = “”
# app/config/config_test.yml
swiftmailer:
disable_delivery: true
# app/config/config_dev.yml
swiftmailer:
disable_delivery: true
The following configuration intercepts the sending process so you can check the email to be send.
# app/config/config_dev.yml
web_profiler:
…
intercept_redirects: true