I begin with Symfony 4 and I want to install FosUserBundle with this link : https://symfony.com/doc/master/bundles/FOSUserBundle/index.html
First :
My problem is that I don't know where to find the "app/config/config.yml" file to uncomment the translator and to configure :
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: AppBundle\Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
Second :
I think that I have to create the security.yml file in "config/packages/" directory, is that right ?
Third :
And in which file to add the route ?
Could you help me, please ? :)
You can't use FOSUSerBundle on Symfony4 at the moment. Support has not been merged yet. You can follow development here.
If you want to use FOSUserBundle with Symfony4 you can try the patch Ryan provided here.
This is the solution I found to work.
First:
app/config/config.yml
doesn't exist anymore instead the configs have been moved to the config folder. For the FOS User Bundle the correct location:/config/packages/fos_user.yaml
. As already noted, use the dev-master version FOSUserBundle, it supports 4(still a little work in progress but good enough).Second:
You are correct, a simple solution is do a
composer require security
and the recipe will take care of that for you. https://symfony.com/doc/current/security.html for more info.Third:
The default FOS User Bundle routes:
fos_user: resource: "@FOSUserBundle/Resources/config/routing/all.xml"
More info on the FOS routing (step 6)is helpful https://symfony.com/doc/master/bundles/FOSUserBundle/index.html
Also, I recommend looking at the yaml samples in symfony routing documentation. It may make things a little more clear when configuring the routes with relation to FOS User Bundle. https://symfony.com/doc/current/routing.html
I've resolved the problem followed this:
download FOSUserBundle using composer:
composer require friendsofsymfony/user-bundle "~2.0"
At the end of the installation you will have the following error message :
Update config/packages/framework.yaml to add templating configuration
Update the schema with the informations from your User class entity
At this point, all is installed and configured to use FOSUserBundle in Symfony 4. Run the following command to check if all is ok
If you don't have any error message, you can test ! You can run the web server to test your application
all tutorial here: https://vfac.fr/blog/how-install-fosuserbundle-with-symfony-4
ok i have same problem and it should be like that first:as @sean Baharmi says you should create /config/packages/fos_user.yaml and inter configuration like this
then in framework.yaml you should enter following because of
FOSUserBundle
dependenciesalso for add routing in /config/rourtes/routes.yaml add
then it is ready to work
hope works for you