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.
4007 questions
21
votes
6 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
  • 2,278
  • 10
  • 33
  • 58
20
votes
2 answers

Symfony 4: "Autowire: you should configure its value explicitly."

I'm starting to working with Symfony4 and I meet the following error when I try to run my server: Cannot autowire service "App\Controller\CharacterInformation": argument "$region" of method "__construct()" is type-hinted "string", you should…
user10562377
19
votes
4 answers

Visual Studio Code PHP Intelephense gets errors which aren't

I'm working on a Symfony 4 project using Visual Studio Code with Intelephense. Intelephense gets errors which aren't. There are some examples: Undefined method 'uasort'. This error corresponding to this code: // Collection creation of seasons used…
Christophe Dubois
  • 283
  • 1
  • 3
  • 12
18
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,209
  • 1
  • 8
  • 25
18
votes
7 answers

Symfony 4 is painfully slow in DEV

I try to run a simple Symfony 4 project on a docker container. I have tested regular PHP scripts, and they work very well. But, with Symfony project, the execution gets ridiculously slow. For example, a page without any significant content takes…
user3429660
  • 2,420
  • 4
  • 25
  • 41
17
votes
5 answers

How to get POST global variable in PHP Symfony 4?

I have a very strange problem getting the result of a POST global variable in Symfony 4. I tried this way: $date = $request->request->get('date'); This is how I actually send the AJAX request when the Calendar input's date changed: onSelect:…
Alexandre Martin
  • 1,472
  • 5
  • 14
  • 27
17
votes
4 answers

Generating CRUD in symfony 4

After releasing Symfony 4.0, there is no support for SensioGeneratorBundle. hence the command php app/console generate:doctrine:crud is not available. They suggest to use MakerBundle, but I could not find appropriate replacement for CRUD…
Mahdi
  • 664
  • 3
  • 15
  • 35
16
votes
1 answer

How write a Symfony Flex recipe for a new bundle?

I tried to find any documentation about using Symfony Flex but so far no luck. Almost all docs point to installing a bundle that uses symfony Flex, not how to create a bundle that is using it. I even tried to reverse engineer some of the packages…
HubertNNN
  • 1,727
  • 1
  • 14
  • 29
16
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,578
  • 3
  • 16
  • 34
16
votes
4 answers

The lock file is not up to date with the latest changes in composer.json

I'm trying to clone a github repository and issue a composer install on it. But I am getting this: Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update…
user6313136
  • 275
  • 1
  • 3
  • 10
15
votes
3 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
  • 922
  • 1
  • 7
  • 19
15
votes
6 answers

How to start local server with symfony 5 or downgrade version to 4.4?

I started a new project in new Symfony 5 and i can't open my local server. On Symfony 4.4 the command PHP bin/console server:run is OK, But with Symfony 5 the command appears not to be defined... C:\Users\Chris\Code\api-test> php bin/console…
Fradé
  • 195
  • 1
  • 2
  • 9
15
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,651
  • 3
  • 13
  • 31
15
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
  • 2,127
  • 6
  • 25
  • 61
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
  • 1,695
  • 1
  • 20
  • 43