17 Oct 2018

feedSymfony Blog

New in MakerBundle 1.8: Instant User & Login Form Commands

Symfony's security system has always been flexible. But over the past few years, it's also become increasingly easy to tap into that power: by creating Guard authenticators and voters for complex authorization rules.

But, we can do more. For example, Symfony security users are so flexible, they can be confusing to set up. And creating a Guard authenticator, while clear and powerful, requires some work. Can we have both flexibility and rapid development? I think so - thanks to two new commands added to MakerBundle.

make:user

Ryan Weaver

Contributed by
Ryan Weaver
in #250.

Ready to start your security system? First you need a user. But, does your entity need to be saved to the database? And is your app responsible for checking passwords? MakerBundle 1.7 will guide you through these decisions and generate exactly what you need:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
$ php bin/console make:user

The name of the security user class (e.g. User) [User]:
> User

Do you want to store user data in the database (via Doctrine)? (yes/no) [yes]:
> yes

Enter a property name that will be the unique "display" name for the user
(e.g. email, username, uuid) [email]:
> email

Will this app need to hash/check user passwords? Choose No if passwords
are not needed or will be checked/hashed by some other system (e.g. a single sign-on server).
Does this app need to hash/check user passwords? (yes/no) [yes]:
> yes

created: src/Entity/User.php
created: src/Repository/UserRepository.php
updated: src/Entity/User.php
updated: config/packages/security.yaml

That's it! Depending on your answers, the command will create a User class/entity and update your security.yaml file to configure a secure password encoder (if needed) and a user provider. The generated code has clear comments so you can continue updating everything for your needs.

make:auth

Nicolas Philippe

Contributed by
Nicolas Philippe
in #266.

Now that you have a User class, it's time to let your users log in. Want a complete form login system in one command? In MakerBundle 1.8, it's no problem. The new make:auth command can create an entire form authentication system, or an empty authenticator, based on your answers:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
$ php bin/console make:auth

What style of authentication do you want? [Empty authenticator]:
[0] Empty authenticator
[1] Login form authenticator
> 1

The class name of the authenticator to create (e.g. AppCustomAuthenticator):
> LoginFormAuthenticator

Choose a name for the controller class (e.g. SecurityController) [SecurityController]:

created: src/Security/LoginFormAuthenticator.php
updated: config/packages/security.yaml
created: src/Controller/SecurityController.php
created: templates/security/login.html.twig

This creates the login route, controller and template as well as a Guard authenticator that handles the login submit, includes CSRF protection and redirects intelligently on success and error. Your authenticator class will have a few minor TODOs inside (usually just 1) that you'll need to finish. But, you won't need to modify any config files.

The result? A fully functional login system in minutes that you have full control over. Customize the template to match your look and update the code in your authenticator to add anything special you need during the login process.

You can also generate a "empty" authenticator to use for whatever other authentication you need. Want support to generate other kinds of authenticators? Just open a pull request!

Happy security!


Be trained by Symfony experts - 2018-10-17 Paris - 2018-10-22 Clichy - 2018-10-22 Clichy

17 Oct 2018 1:24pm GMT

16 Oct 2018

feedSymfony Blog

Pre-conference workshops at SymfonyCon Lisbon are almost all sold out!

The international Symfony conference is coming in less than 2 months, on December 6th and 7th in the fantastic Lisbon, Portugal. Pre-conference workshops at SymfonyCon Lisbon are organized on December 4th and 5th and all of them are almost sold out! If you want to get trained before the conference, you might secure your workshop ticket before there are all gone!

We're very pleased to announce that we have added a new workshop to the list:

Discover the Sylius plugin development with Symfony 4.1, one-day workshop. You will be trained by Sylius Core Team Members Mateusz Zalewski & Łukasz Chruściel. Learn all about how to implement a reusable plugin for your Sylius-based e-commerce application that will be crafted to your needs. We will use the most recent Symfony version, fulfilling its conventions and recommended practices. Using BDD methodology, we will not forget about tests that will describe your custom business logic and ensure us that we write clean and shiny code. During the workshop, we will be aiming to make plugin usable with Symfony Flex to make installation and configuration more developer-friendly.

You can combo this one-day workshop with the others one-day workshops already online but there are only a few seats left for the following workshops. Registration for these workshops is not available on both pre-conference workshop days as the workshops might already be sold out on selected dates:


Be trained by Symfony experts - 2018-10-17 Paris - 2018-10-22 Clichy - 2018-10-22 Clichy

16 Oct 2018 8:10am GMT

14 Oct 2018

feedSymfony Blog

A Week of Symfony #615 (8-14 October 2018)

This week development activity increased in preparation for the upcoming release of Symfony 4.2. We simplified form extensions to no longer require any configuration, improved the Finder component to allow reversing the previous sorting and added new features to the profiler to display logs context and allow to filter logs by level.

Symfony development highlights

This week, 80 pull requests were merged (57 in code and 23 in docs) and 89 issues were closed (68 in code and 21 in docs). Excluding merges, 45 authors made 5,430 additions and 4,171 deletions. See details for code and docs.

2.8 changelog:

3.4 changelog:

Master changelog:

Newest issues and pull requests

They talked about us

Upcoming Symfony Events

Call to Action


Be trained by Symfony experts - 2018-10-17 Paris - 2018-10-22 Clichy - 2018-10-22 Clichy

14 Oct 2018 8:09am GMT