Questions tagged [symfony]

Symfony refers to both a PHP framework for building web applications as well as a set of components on which the framework is built. This tag refers to the currently supported major versions 3.x, 4.x, 5.x and 6.x. Alternatively, you can specify an exact version using the respective tag. This tag should not be used for questions about Symfony 1.x. Please use the Symfony1 tag instead.

Symfony is a framework for web and CLI-applications built on top of a catalogue of Symfony components. It is free software released under the MIT license. The project's homepage is symfony.com.

Symfony aims to speed up the creation and maintenance of web applications and replace repetitive coding tasks by providing a rich set of components and integrations for other libraries through bundles. It has a low-performance overhead used with a bytecode cache and is aimed at building robust applications in an enterprise context, and aims to give developers complete control over the configuration: from the directory structure to the foreign libraries. Almost everything can be customized. To match enterprise development guidelines, Symfony is bundled with additional tools to help developers test, debug and document projects. Most of the components making up the framework can be used outside of the framework in other projects and libraries.

Components

Besides being a full-stack framework, Symfony is also a set of decoupled and Components.

Some of the Components have their own tag:

Information

This tag should be used for generic Symfony questions. You can also use other tags when the question is related to a specific version: , , , , , , , , , , , , , , , , , , , and .

If your question is about Symfony 1.x, please use instead.

The latest stable version can be found on the releases page.

Symfony also maintains Long Term Support (LTS) releases, which are held for several years (while “normal” releases are only maintained for about eight to ten months). The Symfony team is committed to providing a direct upgrade path between Long Term Support releases.

Related projects

Symfony is used as a basis for many other projects, such as , or

Useful links

Note: Before using any documentation, verify that the version of the documentation matches the Symfony version of your installation.

Upgrade between each version:

Interesting questions:


Symfony is released under the MIT license. The full license text is available on the website.

73565 questions
70
votes
2 answers

How can I use now() in Doctrine 2 DQL?

$ php app/console doctrine:query:dql 'SELECT NOW()' [Doctrine\ORM\Query\QueryException] [Syntax Error] line 0, col 7: Error: Expected known function, got 'now' How can I use MySQL's NOW() function with Doctrine's DQL?
Eduardo Moniz
  • 2,095
  • 3
  • 18
  • 27
70
votes
7 answers

Best way to create a test database and load fixtures on Symfony 2 WebTestCase?

I have a WebTestCase that executes some basic routes in my application. I want to, on the setUp method of PHPUnit, create a test database identical to my main database, and load fixtures into it. I'm currently doing some workaround and executing…
Daniel Ribeiro
  • 10,156
  • 12
  • 47
  • 79
69
votes
12 answers

Symfony2 Setting a default choice field selection

I am creating a form in the following manner: $form = $this->createFormBuilder($breed) ->add('species', 'entity', array( 'class' => 'BFPEduBundle:Item', 'property' => 'name', …
Matt G
  • 1,332
  • 2
  • 13
  • 25
69
votes
3 answers

Remove "Remaining deprecation notices" in Symfony 2.8

I'm new on Symfony and PHPUnit. I would like to run some tests, there are a lot of deprecation notices. But it does not matter because I'll stay on Symfony 2.8 for now. Do you know if it's possible to remove them? I try to find out by myself, but…
Chilipote
  • 1,037
  • 1
  • 8
  • 30
69
votes
4 answers

A YAML file cannot contain tabs as indentation

This is my first work with Symfony 2. All I am trying to do here is whenever the user clicks on the submit button he will go to another page. But my index page isn't loading. They are saying there is something wrong with my routing file,…
odbhut.shei.chhele
  • 5,834
  • 16
  • 69
  • 109
69
votes
5 answers

Why updating of dependencies in composer is so slow?

I am using composer (http://getcomposer.org/) to manage installed bundles in the Symfony2 (symfony v 2.1.3). Version of the composer is de3188c. I have problem that when I add new bundle into the composer.json and execute it the time to show…
Myth Rush
  • 1,088
  • 1
  • 9
  • 19
69
votes
16 answers

How to retrieve all Variables from a Twig Template?

Is it possible to retrieve all variables inside a Twig template with PHP? Example someTemplate.twig.php: Hello {{ name }}, your new email is {{ email }} Now I want to do something like this: $template =…
Stefan Neubig
  • 958
  • 1
  • 7
  • 8
69
votes
5 answers

Symfony2 collection of Entities - how to add/remove association with existing entities?

1. Quick overview 1.1 Goal What I'm trying to achieve is a create/edit user tool. Editable fields are: username (type: text) plainPassword (type: password) email (type: email) groups (type: collection) avoRoles (type: collection) Note: the last…
ioleo
  • 4,697
  • 6
  • 48
  • 60
68
votes
5 answers

Accessing session from TWIG template

I've searched a lot on the net how to access the global $_SESSION array from TWIG template and found this: {{app.session.get('index')}}, but when I'm calling it, it returns an empty string. I have a $_SESSION['filter']['accounts'] and I'm getting…
haynar
  • 5,961
  • 7
  • 33
  • 53
68
votes
21 answers

Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

I keep getting this problem everytime i try to migrate using the commandline: php bin/console make:migration or even doctrine:migration status when i try the doctrine:migration:sync-metadata-storage as they tell me I still get the same error…
Aziz Bouaouina
  • 791
  • 1
  • 5
  • 4
68
votes
3 answers

Id attribute on form tag symfony

I would like to define a id attribute on my symfony2 forms. I've tried with this in my twig template: {{ form_start(form, {'id': 'form_person_edit'}) }} But it seems not working.
wonzbak
  • 7,734
  • 6
  • 26
  • 25
67
votes
1 answer

What does ~ mean in the YML configuration file in Symfony 2?

What does ~ mean in the YML configuration file in Symfony 2? For example: NotBlank: ~
Tuong Le
  • 18,533
  • 11
  • 50
  • 44
67
votes
8 answers

How to set a class attribute to a Symfony2 form input

How can I set the HTML class attribute to a form using the FormBuilder in Symfony2 ? Something like this: ->add('birthdate', 'date',array( 'input' => 'datetime', 'widget' => 'single_text', 'attr' => array( 'class'…
Jean-Philippe Bond
  • 10,089
  • 3
  • 34
  • 60
67
votes
11 answers

Conflict on Template of Twig and Vue.js

I'm doing a program using Slim 2 that uses Twig as my templating engine. so It uses the syntax {{ foo }} in php file. On the other hand, I'm using vue.js, it also uses {{ bar }}. E.g. I'm gonna do the two way binding, below is my html code.
Wesley Brian Lachenal
  • 4,381
  • 9
  • 48
  • 81
67
votes
5 answers

Use Limit and Offset in Doctrine2 query

I'm trying to do the pagination, but there is an error: [Syntax Error] line 0, col 57: Error: Expected end of string, got 'limit' I'm not quite sure if this is the right syntax (and logic) to make my query: public function getFriendsFromTo ($user,…
Faery
  • 4,552
  • 10
  • 50
  • 92