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
74
votes
1 answer

How can I reuse a block multiple times?

How can I render a block multiple times within a view in a twig template? Currently I do have a block, let's call it something defined in an included (via render) twig file. I then include it at the layout-twig file using the following: {% block…
Chris
  • 8,031
  • 10
  • 41
  • 67
74
votes
4 answers

Laravel queue process timeout error

I'm on Laravel using php artisan queue:listen to run queued jobs. One of these jobs is fairly involved and takes a long time, and so I'm getting the following error: [Symfony\Component\Process\Exception\ProcessTimedOutException] …
Will Durney
  • 1,168
  • 2
  • 13
  • 16
73
votes
1 answer

phpunit restarting tests randomly

I am trying to test my symfony2 application using PHPUnit. I got one project where everything works as expected, but on my other project I have this strange behaviour that PHPUnit either stops executing the Test Suite randomly near the end of all…
Sgoettschkes
  • 13,141
  • 5
  • 60
  • 78
73
votes
5 answers

Doctrine array vs simple_array vs json_array

I am using symfony and doctrine as my ORM. For available types I have: array simple_array json_array I am wondering what the difference is between each of them: when do I use one or the other? Can I have a demonstration for each of them to…
0x1gene
  • 3,349
  • 4
  • 29
  • 48
73
votes
4 answers

How to include CSS file in Symfony 2 and Twig?

I'm playing around with Symfony2, and I have problems including CSS and JS files in Twig template. I have a bundle named Webs/HomeBundle inside which I have HomeController with indexAction that renders a twig template file: public function…
Limeni
  • 4,954
  • 8
  • 31
  • 33
73
votes
15 answers

Angularjs on a symfony2 application

I'm working on a SF2 application that uses a lot of javascript on the front end. SF2 provides me a good way of building a nice REST app, manage my database with doctrine, use twig for templates and so on, but I would like to use Angularjs. I know…
Louis Grellet
  • 1,083
  • 2
  • 10
  • 14
72
votes
4 answers

How to get the _locale variable inside in a Symfony layout?

I'm working with Symfony 2 on a site which having 2 languages, and I want to change patterns of my routes depending on user locale language ! Example: user_login_en: pattern: /en/user/login.html defaults: { _controller:…
Sybio
  • 8,565
  • 3
  • 44
  • 53
72
votes
14 answers

Laravel migrations: Class "not found"

I am deploying a Laravel barebone project to Microsoft Azure, but whenever I try to execute php artisan migrate I get the error: [2015-06-13 14:34:05] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message…
Washery
  • 1,037
  • 1
  • 12
  • 23
72
votes
10 answers

How to use absolute path in twig functions

I have an application with Symfony2 (2.2). When I want to send a mail, I'm having trouble with the paths, which are all relative paths and obviously aren't working inside emails for rendering the paths I'm using:
rkmax
  • 17,633
  • 23
  • 91
  • 176
72
votes
3 answers

How do I delete an entity from symfony2

My first symfony2 project is a list of guests (invited in an event) stored in a database. I have created the entity class Guest with all variables for them (id, name, address, phone number etc.) created the schema in the mysql db created a route…
Radolino
  • 1,834
  • 4
  • 26
  • 48
72
votes
4 answers

How to make form_rest() not display a field with Symfony2?

I've started to use Symfony2 but I've some problems. I wanted to render fields by hand but it doesn't work because my field yet rendered by me is displayed with the form_rest() function too, so I have two same fields. Here is my code :
{{…
Ilan Coulon
  • 1,126
  • 1
  • 7
  • 14
72
votes
1 answer

Difference between ObjectManager and EntityManager in Symfony2?

What's the difference between Doctrine\Common\Persistence\ObjectManager and Doctrine\ORM\EntityManager when using it in a custom form type? I can get the respository using both $this->em->getRepository() and $this->om->getRepository(). class…
gremo
  • 47,186
  • 75
  • 257
  • 421
71
votes
3 answers

Posting JSON objects to Symfony 2

I'm working on a project using Symfony 2, I've built a bundle to handle all my database services which passes JSON data back and forward. My Problem/Question: Is it possible to post a straight up JSON object? Currently I'm spoofing a normal form…
greg
  • 6,853
  • 15
  • 58
  • 71
71
votes
1 answer

Symfony2: how to get all entities of one type which are marked with "EDIT" ACL permission?

Can someone tell me how to get all entities of one type which are marked with "EDIT" ACL permission? I would like to build a query with the Doctrine EntityManager.
stoefln
  • 14,498
  • 18
  • 79
  • 138
71
votes
6 answers

"usort" a Doctrine\Common\Collections\ArrayCollection?

In various cases I need to sort a Doctrine\Common\Collections\ArrayCollection according to a property in the object. Without finding a method doing that right away, I do this: // $collection instanceof…
luiges90
  • 4,493
  • 2
  • 28
  • 43