senseexception / intl-format-bundle
A Symfony bundle of the IntlFormat wrapper library for PHP intl messages
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.3 || ^8.0
- ext-intl: *
- senseexception/intl-format: ^2.0
- symfony/config: ^4.4 || ^5.0
- symfony/dependency-injection: ^4.4 || ^5.0
- symfony/http-foundation: ^4.4 || >= 5.0.7, < 6.0.0
- symfony/http-kernel: ^4.4 || ^5.0
- symfony/twig-bundle: ^4.4 || ^5.0
Requires (Dev)
- infection/infection: ^0.18
- phpstan/phpstan: ^0.12
- phpstan/phpstan-phpunit: ^0.12
- phpunit/phpunit: ^9.3
- psalm/plugin-phpunit: ^0.15
- psalm/plugin-symfony: ^2.3
- vimeo/psalm: ^4.7
This package is auto-updated.
Last update: 2022-05-06 21:17:39 UTC
README
A Symfony bundle of the Intl-Format wrapper library for PHP intl messages. This bundle is currently in development and might introduce BC breaks.
Installation
You can install it with Composer.
composer require senseexception/intl-format-bundle
If the composer installation with symfony/flex didn't already register the bundle, you need to register it into your bundles.php manually:
return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Budgegeria\Bundle\IntlFormatBundle\BudgegeriaIntlFormatBundle::class => ['all' => true], // ... ];
Configuration
By default a configuration doesn't need to be added if the needed locale is en_US
and USD
the currency. For any other
locale or currency you can add the following configuration to your project and configure the needed locale and currency
values:
budgegeria_intl_format: locale: 'de_DE' currency: 'EUR'
Usage
IntlFormatBundle implements the functionality of Intl-Format and provides Twig extensions for using the documented type specifiers of the library.
Filters
Internationalization text formatting:
{{ "This is the %ordinal time that the number %integer appear"|intl_format(4, 6000) }} {# This is the 4th time that the number 6.000 appear #}
Functions
Internationalization text formatting:
{{ intl_format("This is the %ordinal time that the number %integer appear", 4, 6000) }} {# This is the 4th time that the number 6.000 appear #}
Currency symbol of configured locale:
{{ currency_symbol() }}
{# € #}