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
14
votes
3 answers

Symfony4 "object not found by the @ParamConverter annotation" 404 error

I discover Symfony4 with similar blog sample like describe in https://symfony.com/doc/current/routing.html Then I added a new route to add /blog/about page. So a part of code in my src/Controller/BlogController.php is: /** * @Route("/blog/{id}",…
bcag2
  • 1,988
  • 1
  • 17
  • 31
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
  • 697
  • 2
  • 10
  • 17
14
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
  • 141
  • 1
  • 1
  • 5
14
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
  • 558
  • 5
  • 22
13
votes
3 answers

Symfony PHPUnit - Inject dependency

I want to test this TokenProvider
Kevin
  • 4,823
  • 6
  • 36
  • 70
13
votes
6 answers

Symfony 4 : Override public services in container

I am migrating our project to Symfony 4. In my test suites, we used PHPUnit for functional tests (I mean, we call endpoints and we check result). Often, we mock services to check different steps. Since I migrated to Symfony 4, I am facing this…
Mohammed Mehira
  • 343
  • 1
  • 3
  • 9
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
  • 1,285
  • 1
  • 16
  • 26
12
votes
2 answers

Symfony 4 phpunit : KERNEL_CLASS env variable error

I'm trying to learn how to make phpunit by testing the User class made by "make:user" but i'm facing this problem when extending "KernelTestCase" and run the test : LogicException: You must set the KERNEL_CLASS environment variable to the…
Rayhan
  • 135
  • 1
  • 1
  • 7
12
votes
5 answers

How to exclude deprecation messages from logs in Symfony 4?

I have migrated an application from Symfony 3.4 to Symfony 4.4. Now I have a lot of deprecations for each request/ Sf command (I can't fix that deprecations). How can I exclude deprecations from the log for this Symfony App?
acantepie
  • 329
  • 1
  • 3
  • 9
12
votes
2 answers

How do I handle special chars in the credentials of the Symfony Mailer component in SMTP transport?

Context In Symfony 4.3 a new emailer was introduced. See here: https://symfony.com/blog/new-in-symfony-4-3-mailer-component https://symfony.com/doc/4.4/mailer.html. For the SMTP transport it is established that the DSN in the ENV var has this…
Xavi Montero
  • 9,239
  • 7
  • 57
  • 79
12
votes
2 answers

Symfony 4 Dotenv escape special characters

I use a password with a special char and symfony return an error "Malformed parameter "url"." How can i use this kind of password ? foo?bar I try with variables like…
n44s
  • 443
  • 4
  • 18
12
votes
10 answers

How to fix "https://repo.packagist.org/packages.json does not contain valid Json"?

I've an issue with composer running on a vagrantbox (Centos 7), which started to just suddenly happen. I've already tried manually running the command/solution mentioned on the link below but to no avail. (To clarify, i'm using vagrant not docker,…
StacOlem
  • 153
  • 1
  • 2
  • 8
12
votes
7 answers

Script cache:clear returned with error code 255

I installed Symfony 4.2 via composer composer create-project Symfony/website-skeleton my-project everything works correctly, then I put the project in gitlab. a friend of mine tried to clone it on its own computer in order to work on the same…
Ely
  • 303
  • 1
  • 2
  • 12
12
votes
3 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
  • 16,349
  • 8
  • 82
  • 131
11
votes
5 answers

Symfony 4 login form : authenticating successfully, but authentication immediately lost after redirect

I built a login form following this form login setup doc. This is working fine on localhost but not on the production server. On both localhost and prod, authentication begins successfully Guard authentication successful Guard authenticator set…
Kojo
  • 315
  • 1
  • 10
  • 22