Questions tagged [symfony4]

Symfony is a PHP framework developed by SensioLabs. Symfony 4 was released in November 2017.

Symfony is a PHP web framework first released in July 2011 and was created by SensioLabs. Symfony 4 was released in November 2017. The latest LTS is 4.4.8 released in November 2019 and has support until 2022.

Differences from Symfony 3

  • Symfony Flex automates many of the tasks that previously had to be done manually - it’s based on Symfony Recipes, which are a set of automated instructions.
  • Version 4 also recommends a bundle-less setup, e.g. putting many of the source files directly in /src instead of something like /src/AppBundle.
  • Installing using the Symfony skeleton will create a relative small version of the app. Additional packages need to be added. A more fully-featured version (more similar to the »Symfony Standard Edition« in Symfony 3) is available with the Symfony Demo Application.
  • Minimum PHP 7.1.3

Documentation / Resources

  • Overview: Documentation for current version.
  • Flex: New way to manage Symfony apps.
  • Best Practices: Best practices for developing web apps, esp. the ones using the full-stack Symfony framework.
  • Symfony Recipes Server: Includes official and community recipes.
3929 questions
15
votes
4 answers

What will be the best practice of code separating for a large projects in Symfony4?

The release of the popular framework's 4th version was marked by a capital changes in the structure for projects. Including the official documentation notes the following regarding the code bundling (http://symfony.com/doc/current/bundles.html): In…
Vitaly Vesyolko
  • 470
  • 4
  • 17
15
votes
5 answers

Symfony 4 bundles working

How can I create library bundle on Symfony 4? In Symfony 3 I use this command: php bin/console generate:bundle but in new version not working. And is possible use bundles like Symfony 3, for example, i have blog bundle and telegram bot bundle if not…
A.Seddighi
  • 866
  • 1
  • 15
  • 28
14
votes
5 answers

Symfony 4 handling null DateType form field

I have a form in Symfony 4 where I implement the DateType as a text field ->add('DateOfBirth', DateType::class, array( 'required' => false, 'widget' => 'single_text', 'empty_data' = )) however the field is optional to fill in for the…
Element Zero
  • 1,466
  • 2
  • 10
  • 27
14
votes
3 answers

Cannot inject Templating on Symfony 4 Service

I have the following class: EmailNotification namespace App\Component\Notification\RealTimeNotification; use Symfony\Bridge\Twig\TwigEngine; use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; use…
iamjc015
  • 1,753
  • 4
  • 21
  • 47
14
votes
3 answers

Route is in debug list but returns 404 in Symfony 4

Ok, so I just installed latest version Symfony 4. Run the browser after installation and a nice welcome greeting shows. All good! Then I created a new controller using make:controller. I named this controller Client and is using Annotations, same…
Riza
  • 647
  • 2
  • 10
  • 16
13
votes
5 answers

Symfony 4, get .env parameter from a controller, is it possible and how?

From symfony 4, I want create a global parameter and get the value of this parameter from a controller. This parameter is the path of an another app in the server. So, I thinked add the paramerter in the .env file. But how can I get the value of…
matthieu lopez
  • 1,558
  • 4
  • 24
  • 61
13
votes
1 answer

Migrate to symfony 4 from symfony 3.4

My project is currently setup with 3.4 version of symfony. I want to move to symfony4. So I moved to symfony4 as per suggestions in http://symfony.com/doc/current/setup/upgrade_major.html. In my current project there are many custom bundles are…
Jigar Pancholi
  • 1,009
  • 1
  • 7
  • 23
13
votes
2 answers

symfony/skeleton and symfony/website-skeleton

At https://symfony.com/doc/current/setup.html you are instructed to run: composer create-project symfony/website-skeleton my-project whereas at http://symfony.com/doc/current/quick_tour/the_big_picture.html you are instructed to run: composer…
user3425506
  • 646
  • 1
  • 7
  • 17
12
votes
5 answers

My profiler toolbar isn't showing up in symfony 4.3.1

In my .env file, I have specified my app environment to be dev and debug to be true like so: APP_ENV=dev APP_DEBUG=true In my config/packages/dev/web_profiler.yaml file I have the following: web_profiler: toolbar: true intercept_redirects:…
Majo0od
  • 1,896
  • 8
  • 28
  • 48
12
votes
3 answers

Symfony AutoWire multiple services same class

i am in the process of upgrading a large application to 4.2 and the $this->get(".....") from inside the controller is deprecated and one should use AutoWire instead. i am running into the problem that i have 2 services, which are in fact from the…
Helmut Januschka
  • 1,378
  • 1
  • 14
  • 31
12
votes
6 answers

Symfony 4 extremely slow on windows

I've used Symfony on Windows 10 for my projects for a few years (SF2, SF3), and I recently moved to Symfony 4 to build a new project but performances are catastrophic. Symfony initialization time takes from 5 to 25s, as in this example It is the…
Ben
  • 121
  • 1
  • 5
11
votes
2 answers

Error: Unable to find the controller for path "/login_check". The route is wrongly configured. (LexikJWTAuthentication)

Description When I'm doing a normal request to my symfony server running on http://localhost:8000/api/admin/login_check it returns the desired jwt token. However, when I do it with the functional tests (with ./bin/phpunit) I get the following…
kemicofa ghost
  • 14,587
  • 5
  • 63
  • 112
11
votes
4 answers

How to fetch (join) two records from database using doctrine/symfony4

I am learning about Symfony and Doctrine and created a simple site but I am stuck at this step. I have two tables: users and languages Users Contains: id, username ... Languages Contains: user_id, language... Here is a image of the two Now I am…
hidar
  • 3,939
  • 12
  • 36
  • 61
11
votes
1 answer

Deploying to a production environment with Symfony Flex and --no-dev

I have a couple of large Symfony projects, and have noticed that after updating everything to Symfony 4 (Flex), when our deployment automation runs its normal process of: composer install --no-dev We end up with (for example) this: Symfony…
futureal
  • 2,937
  • 1
  • 20
  • 31
10
votes
4 answers

How to disable "verify_peer" with Symfony Mailer component?

I'm configuring a mail server (postfix), with a self signed certificate, and it seems this self signed certificate is a problem for the Symfony Mailer component. On Swiftmailer, using some configuration such as: transport: stream_options: …
FTW
  • 627
  • 5
  • 15