Skip to content

A PHP-based service for converting numbers into text, supporting Arabic and English.

License

Notifications You must be signed in to change notification settings

marwan-ahmed-23/tafqit-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tafqit (PHP): Number to Text Conversion for Multiple Languages

Tafqit-PHP is a PHP-based service designed to convert numerical values into readable text. Supporting both Arabic and English, this lightweight and modular solution can be easily extended to accommodate additional languages.


🚀 Features

  • Converts numbers into text in Arabic and English.
  • Handles large numbers with precision.
  • Supports customization for currency and subunit formatting.
  • Lightweight and easy to integrate into any PHP project.

Requirements

  • PHP 7.0 or higher.
  • Multibyte string extension (enabled by default in PHP).

🔧 Installation

  1. Clone or download the repository.

  2. Include the src/Tafqit.php file in your project:

    require_once 'path-to-src/Tafqit.php';

📖 Usage

Here's an example of how to use Tafqit-PHP to convert numbers to text:

<?php
require_once 'src/Tafqit.php';

$tafqit = new Tafqit();
echo $tafqit->numberToText("٢٣٤٥", 'ar'); // Outputs: ألفان وثلاثمائة وخمسة وأربعون

Usage with English Numbers

<?php
require_once 'src/Tafqit.php';

$tafqit = new Tafqit();
echo $tafqit->numberToText("2345", 'en'); // Outputs: Two thousand three hundred forty-five

Currency Example

You can customize it to include currency and subunit formatting for specific languages.

📂 Folder Structure

tafqit-php/
├── src/
│   └── Tafqit.php
├── examples/
│   └── example.php
├── tests/
│   └── TafqitTest.php
├── LICENSE
├── .gitignore
└── README.md

Tests

Run the tests using PHPUnit:

phpunit tests/TafqitTest.php

🛠️ Contributing

We welcome contributions! Follow these steps to contribute:

  1. Fork the repository.

  2. Create a new branch:

    git checkout -b feature-branch
  3. Make your changes and commit them:

    git commit -m "Add new feature"
  4. Push to your branch:

    git push origin feature-branch
  5. Open a Pull Request.

🌟 Show Your Support

If you found this project helpful, please consider giving it a ⭐ on GitHub. Your support means the world to us!

Releases

No releases published

Packages

No packages published

Languages