mv/number-words-fr

Convert to words any integer in french

1.0.1 2023-08-16 09:13 UTC

This package is auto-updated.

Last update: 2024-12-17 12:58:01 UTC


README

Converts numbers into words in French (FR_fr) up to 999,999,999,999,999,999.

Build Status

License Build Status Latest Stable Version PHP Version Require Test Coverage Maintainability

Installation

To install this library, you can add it as a dependency to your project using Composer:

composer require mv/number-words-fr-converter

Usage

To use the library, create an instance of IntToWordsFrConverter and call the convert method:

use Mv\NumberWordsFr\Converter\IntToWordsFrConverter;

$converter = new IntToWordsFrConverter();
$result = $converter->convert(12345);

echo $result; // "douze mille trois cent quarante-cinq"

Other locales

use Mv\NumberWordsFr\Converter\IntToWordsFrBeConverter;
use Mv\NumberWordsFr\Converter\IntToWordsFrCaConverter;

$converter = new IntToWordsFrBeConverter();
$resultBe = $converter->convert(72);
$converter = new IntToWordsFrCaConverter();
$resultCa = $converter->convert(72);

echo $resultBe; // "Septante-deux"
echo $resultCa; // "Soixante-douze"

Exists with Fr, FrBe, FrCh, FrCa, FrLu, FrMa, FrTn

Methods

convert(int $int): string

Converts an integer into words.

  • $int: The integer to convert into words.

Contributing

Any contributions, suggestions, or bug reports are welcome! Here's how you can contribute:

  1. Fork the repository.
  2. Create a branch for your changes: git checkout -b feature/my-feature.
  3. Make your changes and commit: git commit -am 'Added my feature'.
  4. Push to the branch: git push origin feature/my-feature.
  5. Create a pull request to the concerned branch of the repository.

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.