This is the last blog post of the blog series that shows the new features of Symfony 5.4 and 6.0. We hope you enjoyed it and now want to upgrade your Symfony applications to these new versions.
Longer RateLimiter Intervals
Contributed by Alexandre Daubois
in #43060.
The RateLimiter component provides a Token Bucket implementation to rate limit input and output in your application. It's commonly used in features like login throttling (e.g. allow up to 5 failed login attempts every hour) and API constraints (e.g. allow up to 1,000 requests per hour). However, some applications need longer intervals to only allow a certain number of evens per month or even per year. That's why in Symfony 5.4 we're adding the perMonth() and perYear() methods to the RateLimiter component.
Simpler Way of Creating Constraint Errors
Contributed by Grégoire Pineau
in #41154.
When using the Validator component, if some validation fails, you get a non-empty list of errors in the form of a ConstraintViolationList class. You need to do the same when creating validation errors yourself. This is cumbersome when you only have one error:
1
2 3 4 5 $violations = new ConstraintViolationList(); $violations->add(new ConstraintViolation('A publish is already running.', '', [], null, '', null));
// e.g. when using ApiPlatform\Core\Bridge\Symfony\Validator\Exception\ValidationException throw new ValidationException($violations);
In Symfony 5.4 we've added a new createSingleConstraint() method so simplify the creation of single-error validation errors:
1
2 3 $violations = ConstraintViolationList::createSingleConstraint('A publish is already running.');
throw new ValidationException($violations);
Lock Files When Appending To Them
Contributed by fwolfsjaeger
in #43796.
The Filesystem component provides OS-independent features related to the file system. One of those utilities is the appendToFile() method, which adds some content at the end of some file. In Symfony 5.4 we've improved it with a third optional boolean argument. If set to true, Symfony will acquire an exclusive lock on the file while proceeding to the writing (it's the same as the \LOCK_EX flag in PHP).
1
2 3 4 $filesystem->appendToFile('logs.txt', 'Email sent to user@example.com');
// the third argument tells whether the file should be locked when writing to it $filesystem->appendToFile('logs.txt', 'Email sent to user@example.com', true);
PhpStan Extractor for PropertyInfo
Contributed by Baptiste Leduc
in #40457.
The PropertyInfo component extracts information about the properties of PHP classes using metadata of popular sources (Doctrine, PHP Reflection, PHPdoc, etc.) In Symfony 5.4 we're adding support to extract information based on the metadata defined for PHPStan, a popular PHP static analysis tool. This will allow you to extract information from metadata like the following:
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class SomeClass { /* @var string|int / public $property1;
/** @var (string|int)[] */
public $property2;
/** @var array */
public $property3;
/** @var array */
public $property4;
/** @var (Dummy | ParentDummy | null) */
public $property5;
}
Did you know? Your company can sponsor the Filesystem, RateLimiter, PropertyInfo or any of the other Symfony components. Show your logo, link and description next to some component both on symfony.com and GitHub. Increase the awareness of your brand, attract new developers to your company and help support the Open Source Symfony project. Interested? Contact us via the "Symfony Backers" option of the Symfony Support page.
Sponsor the Symfony project.
Inicia sesión para agregar comentarios
Otros mensajes en este grupo.

Symfony Messenger component keeps evolving to meet the needs of complex, modern applications. In Symfony 7.3, we're introducing several powerful features to it.
Run Process Using the Shell… https://s

The Routing component provides an impressive list of features to map incoming URLs to your application code. Symfony 7.3 pushes it even further with a set of new features that improve developer experi

Contributed by Mathias Arlaud in

Affected versions
Symfony UX symfony/ux-live-component and symfony/ux-twig-component versions <2.25.1 are affected by this security issue.
The issue has been fixed in the 2.25.1 version of these

Symfony has been reducing the need for configuration in applications for several years now. Thanks to PHP attributes, you can now configure most things alongside the relevant code, removing the need f

This week, development activity focused on polishing Symfony 7.3 ahead of its final release in two weeks. We also continued publishing articles highlighting the new features of Symfony 7.3 and shared

SymfonyOnline June 2025 is almost here, starting in a few weeks on:
June 10-11: Workshop days. June 12-13: Online conference days in English. All talks will be available for replay as soon as