senseexception / intl-format
A wrapper library for PHP to format and internationalize values in messages like sprintf
Installs: 2 878
Dependents: 2
Suggesters: 0
Security: 0
Stars: 12
Watchers: 3
Forks: 4
Open Issues: 0
Requires
- php: ^8.2
- ext-intl: *
Requires (Dev)
- doctrine/coding-standard: ^12.0
- infection/infection: ^0.27.0
- phpstan/phpstan: ^1.11
- phpstan/phpstan-phpunit: ^1.4
- phpstan/phpstan-strict-rules: ^1.6
- phpunit/phpunit: ^10.5
- psalm/plugin-phpunit: ^0.19.0
- vimeo/psalm: ^5.25
README
A wrapper library for PHP to format and internationalize values in messages like sprintf
Why using this library?
Internationalisation is a very important matter when a PHP project covers more than just one country. Every country has its own format for numbers, date or time. The Intl component offers functionality to handle all the formats you need, but not always in a simple way.
This library formats messages using the Intl component of PHP and offers a sprintf-like API.
Example:
echo $intlFormat->format('Today\'s number is %number', 1000.3); // echo "Today's number is 1'000,3" in case of locale de_CH // echo "Today's number is 1,000.3" in case of locale en_US
It is also easy extensible with your own custom formats.
Documentation
Read more about this library in the documentation.
Does it affect GDPR somehow?
Intl-Format itself uses the given data (e.g. timezone, locale) only for formatting purposes with the help of the PHP Intl extension.
Installation
You can install this with Composer.
composer require senseexception/intl-format