Download the PHP package salarmehr/cosmopolitan without Composer
On this page you can find all versions of the php package salarmehr/cosmopolitan. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download salarmehr/cosmopolitan
More information about salarmehr/cosmopolitan
Files in salarmehr/cosmopolitan
Package cosmopolitan
Short Description Super efficient application localisation
License MIT
Informations about the package cosmopolitan
It does not matter if you are developing a console app for personal use or a web application in 30 languages. As far as you display some data you will need to represent your data in the format your users will understand. Don't worry! Cosmopolitan is here to help!
Cosmopolitan is the ultimate tool to localise your PHP application.
Just set the locale (language-country
) and timezone, and your
application is localised for your audience.
- Cosmopolitan is based on intl PHP extension and super-efficient
- Internationalisation for all countries, languages, scripts, calendars, and timezones
Features
- Translation of country codes, language codes, script codes, calendars codes, etc.
- ICU Messages (pluralisation, word gender selection, ...)
- Spelling out numbers
- Localisation of
- Monetary values
- Time (milliseconds to the era)
- Numbers
- Currency name and symbol
- Percentage
- Ordinal numbers
- Quoting text
- Duration
- Units (SI and U.S.)
- ...
Installation
Make sure the php-intl
extension is installed and enabled by checking both phpinfo()
page and php -m
command and run
composer require salarmehr/cosmopolitan
then set the Locale identifier (langauge_COUNTRY) and you are ready to go
use Salarmehr\Cosmopolitan\Cosmo;
echo Cosmo::create('en')->spellout(5000000); // five million - English
echo Cosmo::create('es_ES')->money(11000.4); // 11.000,40 € - Spanish (Spain)
echo Cosmo::create('tu')->unit('temperature','celsius', 26); // 26°C - Turkish
Or you can use the helper function (it is not loaded by default).
e.g. echo cosmo('en')->spellout(120)
prints "one hundred twenty".
Example
Output:
Licence
MIT
Links
All versions of cosmopolitan with dependencies
ext-intl Version *