如何使用 symfony 5 摆脱国际弃用消息

How to get rid of intl deprecation message with symfony 5

自从我将我的项目从 symfony 4.4 更新到 5.0 后,我的所有页面上都有以下弃用警告(只有我有警告):

Please install the "intl" PHP extension for best performance.

在搜索解决方案后,我认为我需要安装 intl 组件,我安装了 :

composer require symfony/intl

我还安装了 symfony/translation 组件:

composer require symfony/translation

问题是弃用仍然存在(即使在 bin/console cache:clear 并重新启动 symfony serve 之后)。

您需要安装 intl PHP 扩展 而不是 Symfony 组件 symfony/intl

请参阅 OS 上的安装手册。 例如 Ubuntu/Debian

sudo apt-get install php-intl

检查是否安装了扩展程序

php -m | grep intl
intl # must be printed this line with extension name

此扩展的官方文档页面https://www.php.net/manual/en/intl.installation.php