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
13
votes
2 answers

Controller must return a response in Symfony2

I have an ajax call in my code. What I want to achieve with the call works fine. I want to delete some records from the database which is actually deleted when the method is called via ajax but as in symfony method it must return a response and…
Zoha Ali Khan
  • 1,659
  • 11
  • 37
  • 56
13
votes
1 answer

Symfony ONE-TO-ONE relation

I am new to symfony2 and have trouble to do a left join between 2 entities. I'm getting following error message, and don't know how to solve this problem: [Semantical Error] line 0, col 69 near 'i': Error: Class Bundle\Entity\Users has no…
user1457328
  • 153
  • 1
  • 1
  • 9
13
votes
2 answers

Symfony2 : customize error pages for different bundles

I have several bundles and I'd like to know if it is possible to customize for each bundle their own error pages. I read the cookbook and the examples show only a generic customize page for all bundles. Is there a way to override the exception…
Boun
  • 413
  • 4
  • 17
13
votes
3 answers

Store objects in sessions Symfony 2

I am writing a small e-shop application with Symfony 2 and I need some way to store the user's shopping cart in a session. I think using a database is not a good idea. The application will use entities like Product, Category, ShoppingCart where…
Aleš
  • 783
  • 3
  • 7
  • 16
13
votes
7 answers

What is the best way to clean the cache without running the console command?

In the admin panel of my project, I programmed the ability to change the database name to use. I wrote the new database name in the parameters.ini, and after that the cache had to be cleaned to load the new config. What is the best way to clean the…
Johni
  • 2,933
  • 4
  • 28
  • 47
13
votes
7 answers

How to compare datetime field from Doctrine2 with a date?

I want to get the items which were created today with by a QueryBuilder from Doctrine2. I want to compare the createdAt(Datetime) field with today parameter(Date). Is it possible to do that in one query? $qb =…
gperriard
  • 1,077
  • 2
  • 12
  • 22
13
votes
2 answers

Can Symfony2 form event listener access the service container and how?

As per title, can a Symfony2 form event listener access the service container? This is an example event listener (for post bind event): class CustomerTypeSubscriber implements EventSubscriberInterface { public static function…
gremo
  • 47,186
  • 75
  • 257
  • 421
13
votes
6 answers

Symfony2 : send a HTTP Request

I am trying to make a HTTP Request from one of my controller to contact another URL, the goal being to contact another URL, and to simply print the HTML answer in my page. I tried : $r = new Request(); $r->create('http://www.google.com',…
Gabriel Theron
  • 1,346
  • 3
  • 20
  • 49
13
votes
3 answers

Assetic unable to find file

I am trying to link a css file (that lives in a bundle) inside a twig template : {% stylesheets '@AcmeFooBundle/Resources/public/css/bootstrap.min.css' %} {% endstylesheets %} The first…
Nikos
  • 696
  • 2
  • 9
  • 23
13
votes
2 answers

Form-wide error_bubbling in Symfony 2?

This is how i currently activate errors on my forms: public function buildForm(FormBuilder $builder, array $options) { $builder ->add('title', null, array('error_bubbling' => true)) ->add('content', null, array('error_bubbling'…
vinnylinux
  • 7,050
  • 13
  • 61
  • 127
13
votes
1 answer

Symfony 2: Dependency injection (DI) of Controllers

Is there any chance to make Controllers dependent on their services not via using of service container inside them but through pure constructor dependency injection? I would like to write controllers in this way:
12
votes
1 answer

Doctrine many-to-many relationship wants to create a table twice when I create a migration

Before I describe my problem, it might actually make it clearer if I start with the error I'm getting: $ ./app/console doc:mig:diff [Doctrine\DBAL\Schema\SchemaException] The table with name 'user_media_area' already exists. …
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
12
votes
2 answers

Best way to manage user/group object permissions with Symfony2

I'd like to hear some thoughts on the best way to optimize our schema to achieve the following. We have a number of objects/db entries (events, venues, etc) some of which have children objects (meaning the same permissions apply - images, metas,…
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
12
votes
3 answers

Using pagination in Doctrine2/Symfony2 without Doctrine paginator extension

I'm using Doctrine2 for a project that might get a lot of traffic and I'm welling to do some pagination in a search page and that only fetch 5 results per page So is there a good way for doing this without the need to use the doctrine extension and…
Wissem
  • 1,705
  • 4
  • 16
  • 22
12
votes
1 answer

Doctrine won't let me select specific fields

The symfony framework features an app/console file that can be executed via php to perform some maintenance tasks. It allows users to run DQL queries as well: # php app/console doctrine:query:dql --hydrate=array \ 'SELECT u.id, u.nameFirst,…
1 2 3
99
100