Posted
about 7 years
ago
by
Javier Eguiluz
This week, we continued polishing Symfony 4.1 before its stable release in two weeks. Our focus was on the Messenger component, which gained a ChainSender to implement multiple senders and also added support for middleware factories in config.
... [More]
Meanwhile, the work on Symfony 4.2 has already started and we added support for meta refresh in the BrowserKit component. Lastly, the dates for the SymfonyCon 2018 conference in Lisbon (Portugal) were announced for December 6th to 8th.
Symfony development highlights
2.7 changelog:
15b03a8: [Filesystem] fixed usages of error_get_last()
30ffb61: [Debug] fixed populating error_get_last() for handled silent errors
d7d4e41: [Profiler] removed propel & event_listener_loading category identifiers
974050f: [Session] limited :key for GET_LOCK to 64 chars
b7feafc: [Process] suppress warnings when open_basedir is non-empty
15a7bbd: [Security] fixed logout
e98ce72: [FrameworkBundle] disallowed invalid characters in session.name
05d69bb: [Form] fixed precision of MoneyToLocalizedStringTransformer divisions on transform()
1c520a9: [Security] do not mock the session in token storage tests
3.4 changelog:
10a2d39: [DependencyInjection] shared services should not be inlined in non-shared ones
2a10cc6: [HttpKernel] fixed dealing with self/parent in ArgumentMetadataFactory
5327957: [PropertyInfo] fixed resolving parent|self type hints
c280f8a: [DependencyInjection] allowed defining bindings on ChildDefinition
4f9d907: [DependencyInjection] resolve array env vars
81cef4b: [Validator] use strict type in URL validator
4.1 changelog:
5f0e2d6: [HttpKernel] fixed services are no longer injected into __invoke controllers method
f59ce97: [Messenger] middleware factories support in config
f1967aa: [Messenger] implemented several senders using a ChainSender
160c97e: [Messenger] select alternatives on missing receiver arg or typo
20cc065: [Routing] fixed adding name prefix to canonical route names
Master changelog:
5b41c79: [BrowserKit] added support for meta refresh
ca050f6: [LDAP] added "applyOperations" method to EntryManager
4f4c172: [DependencyInjection] fine tuned dumped factories
Newest issues and pull requests
[RFC] Paginator component
[RFC][Profiler] Enhance the performances panel & time collector
Create a MimeTypeGuesser proxy to improve its performance
They talked about us
Contribute to Symfony: my experience
How to Test Private Services in Symfony
Mastering the Symfony Serializer (PHP Tour slides)
How to Load --config With Services in Symfony Console
Rest Api with Symfony
Symfony 4 Installation and new features
Symfony: Inject Doctrine Repositories in Controllers
The 5 Advantages of Hiring Symfony Developers
Writing integration tests for Symfony 3.4
The New Dynamic Lock Refresh Update in Symfony 4.1
Nuevo en Symfony 4.1: Autowiring mejorado
Nuevo en Symfony 4.1: componente Messenger
Nuevo en Symfony 4.1: mejoras en la salida de los comandos
Contribuer à Symfony: mon expérience
Symfony 4 - Dependency Injection
Be trained by Symfony experts
- 2018-05-22 Clichy
- 2018-05-22 Paris
- 2018-05-22 Clichy
[Less]
|
Posted
about 7 years
ago
by
Javier Eguiluz
This week, we continued polishing Symfony 4.1 before its stable release in two weeks. Our focus was on the Messenger component, which gained a ChainSender to implement multiple senders and also added support for middleware factories in config.
... [More]
Meanwhile, the work on Symfony 4.2 has already started and we added support for meta refresh in the BrowserKit component. Lastly, the dates for the SymfonyCon 2018 conference in Lisbon (Portugal) were announced for December 6th to 8th.
Symfony development highlights
2.7 changelog:
15b03a8: [Filesystem] fixed usages of error_get_last()
30ffb61: [Debug] fixed populating error_get_last() for handled silent errors
d7d4e41: [Profiler] removed propel & event_listener_loading category identifiers
974050f: [Session] limited :key for GET_LOCK to 64 chars
b7feafc: [Process] suppress warnings when open_basedir is non-empty
15a7bbd: [Security] fixed logout
e98ce72: [FrameworkBundle] disallowed invalid characters in session.name
05d69bb: [Form] fixed precision of MoneyToLocalizedStringTransformer divisions on transform()
1c520a9: [Security] do not mock the session in token storage tests
3.4 changelog:
10a2d39: [DependencyInjection] shared services should not be inlined in non-shared ones
2a10cc6: [HttpKernel] fixed dealing with self/parent in ArgumentMetadataFactory
5327957: [PropertyInfo] fixed resolving parent|self type hints
c280f8a: [DependencyInjection] allowed defining bindings on ChildDefinition
4f9d907: [DependencyInjection] resolve array env vars
81cef4b: [Validator] use strict type in URL validator
4.1 changelog:
5f0e2d6: [HttpKernel] fixed services are no longer injected into __invoke controllers method
f59ce97: [Messenger] middleware factories support in config
f1967aa: [Messenger] implemented several senders using a ChainSender
160c97e: [Messenger] select alternatives on missing receiver arg or typo
20cc065: [Routing] fixed adding name prefix to canonical route names
Master changelog:
5b41c79: [BrowserKit] added support for meta refresh
ca050f6: [LDAP] added "applyOperations" method to EntryManager
4f4c172: [DependencyInjection] fine tuned dumped factories
Newest issues and pull requests
[RFC] Paginator component
[RFC][Profiler] Enhance the performances panel & time collector
Create a MimeTypeGuesser proxy to improve its performance
They talked about us
Contribute to Symfony: my experience
How to Test Private Services in Symfony
Mastering the Symfony Serializer (PHP Tour slides)
How to Load --config With Services in Symfony Console
Rest Api with Symfony
Symfony 4 Installation and new features
Symfony: Inject Doctrine Repositories in Controllers
The 5 Advantages of Hiring Symfony Developers
Writing integration tests for Symfony 3.4
The New Dynamic Lock Refresh Update in Symfony 4.1
Nuevo en Symfony 4.1: Autowiring mejorado
Nuevo en Symfony 4.1: componente Messenger
Nuevo en Symfony 4.1: mejoras en la salida de los comandos
Contribuer à Symfony: mon expérience
Symfony 4 - Dependency Injection
Be trained by Symfony experts
- 2018-05-24 Clichy
- 2018-05-28 Paris
- 2018-05-28 Paris
[Less]
|
Posted
about 7 years
ago
by
Javier Eguiluz
Contributed by
Kévin Dunglas and
Nicolas Grekas
in #27049 and #27105.
The Serializer component
... [More]
will be much faster in Symfony 4.1, improving the
performance of your applications up to 40%. Best of all, you don't have to make
any changes in your code to make it faster. Just upgrade to Symfony 4.1 when it
is released at the end of this month.
If you have used the Symfony serializer, you probably know that it works by
normalizing/denormalizing PHP objects into arrays and then encoding/decoding
that array into the desired format (JSON, XML, etc.)
Applications can define lots of normalizers/denormalizers and Symfony must call
the supportsNormalization() method for each of them whenever a new object
is normalized/denormalized. In theory the result of supportsNormalization()
can depend on multiple factors. In practice most normalizers only depend on
the type and format and that information is easily cacheable.
That's the trick used to improve the Serializer performance. We've introduced a
new CacheableSupportsMethodInterface for those normalizers/denormalizers
that only use the type and the format in their supports*() methods:
1
2
3
4
5
6
namespace Symfony\Component\Serializer\Normalizer;
interface CacheableSupportsMethodInterface
{
public function hasCacheableSupportsMethod(): bool;
}
We've already implemented this interface in all the built-in normalizers, so you
don't have to change your code. If you have created your own normalizers, check
if they can be cached in the same way and implement the interface if needed.
According to our own benchmarks, this change can make simple apps which use
few normalizers up to 10% faster. Complex applications with lots of
normalizers, such as API Platform apps, can be up to 40% faster.
Be trained by Symfony experts
- 2018-05-22 Clichy
- 2018-05-22 Paris
- 2018-05-22 Clichy
[Less]
|
Posted
about 7 years
ago
by
Javier Eguiluz
Contributed by
Kévin Dunglas and
Nicolas Grekas
in #27049 and #27105.
The Serializer component
... [More]
will be much faster in Symfony 4.1, improving the
performance of your applications up to 40%. Best of all, you don't have to make
any changes in your code to make it faster. Just upgrade to Symfony 4.1 when it
is released at the end of this month.
If you have used the Symfony serializer, you probably know that it works by
normalizing/denormalizing PHP objects into arrays and then encoding/decoding
that array into the desired format (JSON, XML, etc.)
Applications can define lots of normalizers/denormalizers and Symfony must call
the supportsNormalization() method for each of them whenever a new object
is normalized/denormalized. In theory the result of supportsNormalization()
can depend on multiple factors. In practice most normalizers only depend on
the type and format and that information is easily cacheable.
That's the trick used to improve the Serializer performance. We've introduced a
new CacheableSupportsMethodInterface for those normalizers/denormalizers
that only use the type and the format in their supports*() methods:
1
2
3
4
5
6
namespace Symfony\Component\Serializer\Normalizer;
interface CacheableSupportsMethodInterface
{
public function hasCacheableSupportsMethod(): bool;
}
We've already implemented this interface in all the built-in normalizers, so you
don't have to change your code. If you have created your own normalizers, check
if they can be cached in the same way and implement the interface if needed.
According to our own benchmarks, this change can make simple apps which use
few normalizers up to 10% faster. Complex applications with lots of
normalizers, such as API Platform apps, can be up to 40% faster.
Be trained by Symfony experts
- 2018-05-24 Clichy
- 2018-05-28 Paris
- 2018-05-28 Paris
[Less]
|
Posted
about 7 years
ago
by
Javier Eguiluz
Contributed by
Kévin Dunglas and
Nicolas Grekas
in #27049 and #27105.
The Serializer component
... [More]
will be much faster in Symfony 4.1, improving the
performance of your applications up to 40%. Best of all, you don't have to make
any change in your code to make it faster. Just upgrade to Symfony 4.1 when it
releases at the end of this month.
If you have used the Symfony serializer, you probably know that it works by
normalizing/denormalizing PHP objects into arrays and then encoding/decoding
that array into the desired format (JSON, XML, etc.)
Applications can define lots of normalizers/denormalizers and Symfony must call
to the supportsNormalization() method of each of them whenever a new object
is normalized/denormalized. In theory the result of supportsNormalization()
can depend on multiple factors. In practice most normalizers only depend on
the type and format and that information is easily cacheable.
That's the trick used to improve the Serializer performance. We've introduced a
new CacheableSupportsMethodInterface for those normalizers/denormalizers
that only use the type and the format in their supports*() methods:
1
2
3
4
5
6
namespace Symfony\Component\Serializer\Normalizer;
interface CacheableSupportsMethodInterface
{
public function hasCacheableSupportsMethod(): bool;
}
We've already implemented this interface in all the built-in normalizers, so you
don't have to change your code. If you have created your own normalizers, check
if they can be cached in the same way and implement the interface if needed.
According to our own benchmarks, this change can make simple apps which use
few normalizers up to 10% faster. Complex applications with lots of
normalizers, such as Api Platform apps, can be up to 40% faster.
Be trained by Symfony experts
- 2018-05-22 Clichy
- 2018-05-22 Paris
- 2018-05-22 Clichy
[Less]
|
Posted
about 7 years
ago
by
Javier Eguiluz
Contributed by
Mathieu Piot
in #26332.
Adding help messages to form fields is a common need in web applications.
However, the Symfony
... [More]
Form component doesn't provide this feature and you need
to create a Form extension like the following:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
namespace App\Form\Extension;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
class HelpMessageExtension extends AbstractTypeExtension
{
public function getExtendedType()
{
return FormType::class;
}
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['help'] = $options['help'] ?? '';
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(['help' => null]);
}
}
And then create your own form theme to display this help message:
1
2
3
4
5
6
7
8
9
{% use "bootstrap_4_layout.html.twig" %}
{% block form_row %}
{# ... #}
{% if form.vars.help ?? false %}
{{ form.vars.help }}
{% endif %}
{% endblock form_row %}
In Symfony 4.1, all this will no longer be necessary because you can define the
help message of any form field using the help option:
1
2
3
4
// ...
$builder->add('email', null, [
'help' => 'Make sure to add a valid email',
]);
This is how the help message looks when using our Bootstrap 4 form theme:
Thanks to the diversity initiative we prioritize web accessibility in
everything we do, so the form theme has been updated to include the required
aria-describedby attribute in the form fields that include a help message.
Lastly, if you customize Symfony forms with Twig functions like
form_row(), form_label(), etc. you can now use a new function called
form_help() to get the contents of the help message.
Be trained by Symfony experts
- 2018-05-24 Clichy
- 2018-05-28 Paris
- 2018-05-28 Paris
[Less]
|
Posted
about 7 years
ago
by
Javier Eguiluz
Contributed by
Mathieu Piot
in #26332.
Adding help messages to form fields is a common need in web applications.
However, the Symfony
... [More]
Form component doesn't provide this feature and you need
to create a Form extension like the following:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
namespace App\Form\Extension;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
class HelpMessageExtension extends AbstractTypeExtension
{
public function getExtendedType()
{
return FormType::class;
}
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['help'] = $options['help'] ?? '';
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(['help' => null]);
}
}
And then create your own form theme to display this help message:
1
2
3
4
5
6
7
8
9
{% use "bootstrap_4_layout.html.twig" %}
{% block form_row %}
{# ... #}
{% if form.vars.help ?? false %}
{{ form.vars.help }}
{% endif %}
{% endblock form_row %}
In Symfony 4.1, all this will no longer be necessary because you can define the
help message of any form field using the help option:
1
2
3
4
// ...
$builder->add('email', null, [
'help' => 'Make sure to add a valid email',
]);
This is how the help message looks when using our Bootstrap 4 form theme:
Thanks to the diversity initiative we prioritize web accessibility in
everything we do, so the form theme has been updated to include the required
aria-describedby attribute in the form fields that include a help message.
Lastly, if you customize Symfony forms with Twig functions like
form_row(), form_label(), etc. you can now use a new function called
form_help() to get the contents of the help message.
Be trained by Symfony experts
- 2018-05-22 Clichy
- 2018-05-22 Paris
- 2018-05-22 Clichy
[Less]
|
Posted
about 7 years
ago
by
Javier Eguiluz
Contributed by
Nicolas Grekas
in #26921.
In Symfony 3.4 we made all Symfony services private by default. This is
generally better and
... [More]
makes applications more robust (as explained in the
previous post) but it also has some drawbacks.
The debug:container command for example hides the private services by
default, so it's no longer useful to list the services available in your
application. That's why in Symfony 4.1 we've changed the debug:container
command to show the private services by default and we've also deprecated the
--show-private option.
Independently from being public or private, sometimes it's useful to hide some
services from the debug:container listing because they are not intended for
being used by the developers. In those cases, you can add a dot character
(.) at the beginning of the service ID to turn it into a "hidden service".
Hidden services behave like the rest of services, except for the fact that they
are not included by default in the output of debug:container, so you must
add the new --show-hidden option to show them:
1
$ ./bin/console debug:container --show-hidden
We are already using this feature to hide some internal Symfony services
created by the Lock component.
Be trained by Symfony experts
- 2018-05-24 Clichy
- 2018-05-28 Paris
- 2018-05-28 Paris
[Less]
|
Posted
about 7 years
ago
by
Javier Eguiluz
Contributed by
Nicolas Grekas
in #26921.
In Symfony 3.4 we made all Symfony services private by default. This is
generally better and
... [More]
makes applications more robust (as explained in the
previous post) but it also has some drawbacks.
The debug:container command for example hides the private services by
default, so it's no longer useful to list the services available in your
application. That's why in Symfony 4.1 we've changed the debug:container
command to show the private services by default and we've also deprecated the
--show-private option.
Independently from being public or private, sometimes it's useful to hide some
services from the debug:container listing because they are not intended for
being used by the developers. In those cases, you can add a dot character
(.) at the beginning of the service ID to turn it into a "hidden service".
Hidden services behave like the rest of services, except for the fact that they
are not included by default in the output of debug:container, so you must
add the new --show-hidden option to show them:
1
$ ./bin/console debug:container --show-hidden
We are already using this feature to hide some internal Symfony services
created by the Lock component.
Be trained by Symfony experts
- 2018-05-22 Clichy
- 2018-05-22 Paris
- 2018-05-22 Clichy
[Less]
|
Posted
about 7 years
ago
by
Fabien Potencier
Adopting a Code of Conduct was
a great step forward for the Symfony community. Now, if a community member
encounters an issue of harassment or other unwanted behavior, they need to be
able to report it and get support. This is one of the roles of the
... [More]
CARE team.
Today, I'm very honored and proud to announce the first members of the CARE team
(in alphabetic order):
Emilie Lorenzo
Tobias Nyholm
Michelle Sanver
You can contact any of them directly using their contact details
or you can also contact all of them at once by emailing [email protected].
I want to thank them for volunteering.
Be trained by Symfony experts
- 2018-05-16 Paris
- 2018-05-22 Clichy
- 2018-05-22 Clichy
[Less]
|