symfony/polyfill-intl-icu
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Symfony/polyfill-intl-icu is a package that provides fallback implementations when the Intl PHP extension is not installed in the system. The package primarily caters to the "en" locale and includes functionalities such as checking if intl operation is a failure using intl_is_failure()
, fetching the error code using intl_get_error_code()
, retrieving the error message with intl_get_error_message()
, understanding error name using intl_error_name()
, utilizing Collator, NumberFormatter, Locale, and IntlDateFormatter classes.
Usage of symfony/polyfill-intl-icu is quite straightforward. The package is meant to work automatically providing fallbacks, and you just need to include it via composer. You do not need to call any particular function from the package. The documentation does not provide specific examples of usage, but if you were using functions like intl_is_failure()
, intl_get_error_code()
, intl_get_error_message()
, intl_error_name()
, even if the intl extension is not installed, these would work without reporting any fatal errors. It's like a shield that gracefully handles situations if internationalization functions are not available.
// Include Composer's autoload file
require_once 'vendor/autoload.php';
// Use functions provided by intl extension
if (intl_is_failure(intl_get_error_code())) {
echo 'Error occurred: ', intl_error_name(), ', ', intl_get_error_message();
}
Please note, you need to have added the symfony/polyfill-intl-icu to your project via composer:
composer require symfony/polyfill-intl-icu
Detailed information and documentation on the symfony/polyfill-intl-icu package can be found on the main Polyfill README page at https://github.com/symfony/polyfill/blob/main/README.md. This README provides a broader overview of the symfony polyfill libraries, including the Intl: ICU portion. It is a valuable resource for understanding the capabilities and limitations of this package.