Download the PHP package pinoox/numera without Composer
On this page you can find all versions of the php package pinoox/numera. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pinoox/numera
More information about pinoox/numera
Files in pinoox/numera
Package numera
Short Description Translate Numera
License MIT
Homepage http://www.pinoox.com/
Informations about the package numera
Numera: A PHP Library for Number to Words Conversion
Numera is a PHP library that provides a simple and efficient way to convert numbers to words and vice versa. It supports multiple languages and can be easily extended to support more languages.
- Features
- Installation and Setup
- Install via Composer
- Initialize Numera
- Usage
- Convert Numbers to Words
- Convert Numbers to Summary Words
- Convert Words to Numbers
- Use Camel Case
- Supported Languages
- Set Locale
- Set Locale Fallback
- Get Translates
- Add Translate
- Create a New Language
- Author
- Contributing
- Documentation
- License
Features
- Convert numbers to words (e.g. 1234 to "one thousand two hundred thirty-four")
- Convert words to numbers (e.g. "one thousand two hundred thirty-four" to 1234)
- Support for multiple languages (currently English and Persian, with more to come)
- Camel case support for output words
- Easy to use and extend
Installation and Setup
Install via Composer
You can install Numera using Composer:
Initialize Numera
To use Numera, you need to initialize it with a locale. You can do this using the init
method:
Convert Numbers to Words
To convert a number to words, use the convertToWords
method:
Alternatively, you can use the n2w
method for a simpler syntax:
Convert Numbers to Summary
To convert a number to summary words, use the convertToSummary
method:
Alternatively, you can use the n2w
method for a simpler syntax:
Convert Words to Numbers
To convert words to a number, use the convertToNumber
method:
Alternatively, you can use the w2n
method for a simpler syntax:
You can also specify separators for the w2n
method:
Use Camel Case
To use camel case for output words, use the setCamelCase
method:
Supported Languages
Numera currently supports the following languages:
- English (en)
- Persian (fa)
Set Locale
To set the locale for the Numera object, use the setLocale
method:
Set Locale Fallback
To set the fallback locale for the Numera object, use the setLocaleFallback
method:
Get Translates
To get the translates for the current locale, use the getTranslates
method:
Add Translate
To add translates for a specific locale, use the addTranslate
method:
Add Translate File
To add translates by array file for a specific locale, use the addTranslateFile
method:
Create a New Language
If you want to add support for a new language, please read our Translation Guide for a step-by-step guide on how to create a new language pack.
Author
Numera was created by Pinoox.
Contributing
If you'd like to contribute to Numera, please fork the repository and submit a pull request. We'd love to have your help.
Documentation
- README.md - Documents
- TranslationGuide.md - Guide for creating a new language pack
License
Numera is licensed under the MIT License. See the LICENSE file for more information.