2.1.13

Latest release in branch 2.1
Released 12 years ago (October 10, 2013)

Software Symfony
Branch 2.1
Status
End of life
End of bug fixes June 2013
End of security fixes June 2013
First official release version 2.1.0
First official release date 13 years ago (September 06, 2012)
Supported
PHP versions
PHP ≥ 5.3.3
Release notes https://github.com/symfony/symfony/releases/tag/v2.1.13
Source code https://github.com/symfony/symfony/tree/v2.1.13
Documentation https://symfony.com/doc/current/index.html
Download https://symfony.com/download
Symfony 2.1 Releases View full list

What Is New in Symfony 2.1

Symfony 2.1 is a significant feature release that introduces new components and major enhancements to existing ones. The table below summarizes the key areas of change.

Category Key Changes
New Components Form, Validator, Security (reworked), Finder, Stopwatch, PropertyAccess
Core Enhancements Expression Language, DIC Improvements, New Routing Features
Deprecations Some methods and classes deprecated, paving the way for 2.x
Bug Fixes Numerous fixes across the framework foundation

What are the major new components in Symfony 2.1?

Symfony 2.1 ships with several brand-new, standalone components. The Form and Validator components are now fully decoupled from the framework core, meaning you can use them in any PHP project. This separation was a major architectural shift.

The Security component was almost entirely rewritten for greater flexibility and power. New utility components like Finder (for file system operations) and Stopwatch (for profiling) were introduced, expanding Symfony's toolkit for common development tasks.

How did the Form component improve in version 2.1?

The Form component became a standalone library with a more flexible architecture. A key addition was the PropertyAccess component, which provides a unified way to read and write object/array properties and is used extensively by the Form layer.

Form themes became more powerful with the introduction of theme inheritance. You could now create a base form theme and extend it for specific forms, reducing duplication in your Twig templates significantly.

What routing features were added?

Routing gained the ability to match and generate URLs with non-string parameters, like integers or arrays. This was crucial for advanced use cases, especially when integrated with the new Expression Language support.

The new _format routing parameter became a first-class citizen. It allows you to define the expected response format (like json, xml, html) directly in the route pattern, simplifying content negotiation logic in controllers.

What is the Expression Language and where is it used?

The Expression Language is a compact, powerful language for evaluating expressions, integrated directly into the Dependency Injection Container (DIC) and Security components. In practice, it lets you define complex logic in configuration using a simple syntax.

For security, you can use expressions in access controls. For example, you can write rules like is_granted('POST_EDIT') and user == post.getAuthor() directly in your security configuration, moving complex authorization logic out of your controllers.

How did the Dependency Injection Container evolve?

The DIC introduced expression support for service definitions, allowing dynamic behavior based on configuration. You could now use the Expression Language to conditionally inject services or parameters.

It also added the concept of "lazy services" using proxy managers. This means a service that is expensive to instantiate is only fully created when one of its methods is actually called, which can improve performance on specific workflows.

FAQ

Is the new Form component backwards compatible with Symfony 2.0?
Mostly, but not entirely. While the core concepts remain, the decoupling and internal refactoring introduced some breaking changes. You'll need to update form type classes and check your templates, especially if you used advanced features.

Can I use the standalone Form component in a non-Symfony project?
Absolutely. That was a primary goal of the 2.1 refactoring. You can install it via Composer and use it in any PHP application, which increased its adoption across the ecosystem.

What happened to the old Security component?
It was completely rewritten. The new component offers a more granular, voter-based access decision system which is far more flexible. This means upgrading requires revisiting and likely rewriting your security configuration and custom providers.

Why was the Stopwatch component added?
It provides a standardized way to profile your application's execution time for specific sections of code. It's used internally by the Symfony Profiler but is also available for developers to instrument their own business logic.

Are there any significant deprecations I should be aware of?
Yes, several methods, especially in the HttpFoundation and Routing components, were marked as deprecated. For instance, some methods in the Request class were deprecated in favor of using the ParameterBag objects directly. The release notes contain a full list.

Releases In Branch 2.1

Version Release date
2.1.13 12 years ago
(October 10, 2013)
2.1.12 12 years ago
(August 07, 2013)
2.1.11 12 years ago
(June 02, 2013)
2.1.10 12 years ago
(May 06, 2013)
2.1.9 13 years ago
(March 26, 2013)
2.1.8 13 years ago
(February 23, 2013)
2.1.7 13 years ago
(January 17, 2013)
2.1.6 13 years ago
(December 21, 2012)
2.1.5 13 years ago
(December 20, 2012)
2.1.4 13 years ago
(November 29, 2012)
2.1.3 13 years ago
(October 30, 2012)
2.1.2 13 years ago
(September 20, 2012)
2.1.1 13 years ago
(September 11, 2012)
2.1.0 13 years ago
(September 06, 2012)
2.1.0-RC2 13 years ago
(August 28, 2012)
2.1.0-RC1 13 years ago
(August 04, 2012)
2.1.0-BETA4 13 years ago
(July 23, 2012)
2.1.0-BETA3 13 years ago
(July 15, 2012)
2.1.0-BETA2 13 years ago
(July 09, 2012)
2.1.0-BETA1 13 years ago
(June 21, 2012)