Download the PHP package bakame/laravel-intl-formatter without Composer
On this page you can find all versions of the php package bakame/laravel-intl-formatter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-intl-formatter
Laravel Intl Formatter
This is a Laravel port of the Twig Intl Extension package.
The package can be used in any Laravel based application to quickly handle internationalization by providing helper functions in Blade templates or Laravel codebase.
System Requirements
- Laravel 8 and/or 9
- Symfony Intl component
Installation
Use composer:
Configuration
In order to edit the default configuration you need to publish the package configuration to your application config directory:
The configuration file will be published to config/bakame-intl-formatter.php
in your application directory.
Please refer to the config file for an overview of the available options.
Documentation
Once installed the package provides the following global helper functions:
Country Name
Returns the country name given its two-letter/five-letter code;
Currency Name
Returns the currency name given its three-letter code;
Currency Symbol
Returns the currency symbol given its three-letter code;
Language name
Returns the currency symbol given its three-letter code;
Locale name
Returns the currency symbol given its three-letter code;
Timezone name
Returns the timezone name given its identifier;
Country Timezones
Returns the timezone identifiers of the given country code;
Format Currency
Formats a number as a currency;
Format Number
Formats a number;
Format DateTime
Formats a date and time;
Format Date
Formats a the date portion of a datetime;
Format Time
Formats the time portion of a datetime;
Each function uses the same arguments in the same order as the Twig Extra package filters/functions.
Locale specification
If no locale
is specified in function calls, the function will use the result of Illuminate\Support\Facades\App::currentLocale()
as the locale value to use.
functions signature
In PHP8+, you can use named parameters to improve functions usages as they tend to have a lot of arguments:
In PHP7.4
In PHP8+
Contributing
Contributions are welcome and will be fully credited. Please see CODE OF CONDUCT for details.
Testing
The library:
- has a PHPUnit test suite
- has a coding style compliance test suite using PHP CS Fixer.
- has a code analysis compliance test suite using PHPStan.
To run the tests, run the following command from the project folder.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
Attribution
The package helpers functions are heavily inspired by previous works done by Fabien Potencier on Twig Intl Extension.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-intl-formatter with dependencies
ext-intl Version *
ext-json Version *
bakame/intl-formatter Version ~0.3.0
illuminate/config Version ^8.0 || ^9.0
illuminate/support Version ^8.0 || ^9.0