PHPackages                             curiousyigit/laravel-arqam - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. curiousyigit/laravel-arqam

AbandonedArchivedLibrary[Localization &amp; i18n](/categories/localization)

curiousyigit/laravel-arqam
==========================

laravel-arqam is a laravel packages that converts numbers to arabic words

1.0.3(4y ago)02MITPHPPHP &gt;=7.1.3

Since Nov 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/curiousyigit/laravel-arqam)[ Packagist](https://packagist.org/packages/curiousyigit/laravel-arqam)[ Docs](https://github.com/curiousyigit/laravel-arqam)[ RSS](/packages/curiousyigit-laravel-arqam/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

ABANDONED
=========

[](#abandoned)

This project is abondened and no longer maintained.

laravel-arqam
=============

[](#laravel-arqam)

laravel-arqam helps you convert numbers to arabic words

Installation
------------

[](#installation)

Installation is straightforward, setup is similar to every other Laravel Package.

**1. Install via composer**

```
composer require curiousyigit/laravel-arqam

```

**2. Define the Service Provider and alias**
**Note:** You can skip this step if you are using laravel 5.5 and above as this package supports "**auto-discovery**".

If you are using Laravel 5.0 - 5.4 then you need to add a provider and alias. Inside of your `config/app.php` define a new service provider.

```
'providers' => [
	//  other providers

	curiousyigit\LaravelArqam\ServiceProvider::class,
];

```

Then we want to define an alias in the same `config/app.php` file.

```
'aliases' => [
	// other aliases

	'laravel-arqam' => curiousyigit\LaravelArqam\Facade::class,
];

```

**3. Publish Config File**
The config file allows you to override default settings of this package to meet your specific needs. It also allows you to add your custom currencies.

To generate a config file type this command into your terminal:

```
php artisan vendor:publish  --provider=curiousyigit\LaravelArqam\ServiceProvider

```

This generates a config file at config/arqam.php.

Usage
-----

[](#usage)

This package is very easy to use. Once installed, you can start converting numbers to words in controllers, views, middlewares, models, etc.

**IMPORTANT**The words function expects the number as a **string**. This is done because php has problems dealing with huge numbers. So convert your numbers to **non scientific notation** strings. Decimals are optional. **DO NOT** use numbers with thousand separators. The supported decimal separator is a dot ".". Not applying these precautions may cause unwanted functionality

Limitation
----------

[](#limitation)

Currently, the maximum supported number is (trillions) 999999999999999.999999999. At the time of coding I didn't really see a need in bigger number. I may change it in the future though

**A few examples:**

```
Arqam::words(15500); //فقط الف وخمسمئة وخمسون ريال سعودي لا غير
Arqam::words(169855.2586); //فقط مئة وتسعة وستون الف وثمانمئة وخمسة وخمسون ريال سعودي وستة وعشرون هللة لا غير
Arqam::words(169855.2586, 'BHD', 3, 3); //فقط مئة وتسعة وستون الف وثمانمئة وخمسة وخمسون دينار بحريني ومئتين وثمانية وخمسون فلس لا غير
Arqam::wordsNoCurrency(7900); //فقط سبعة اﻵف وتسعمئة لا غير
Arqam::wordsNoCurrency('4544.446', 2, 2); //فقط اربعة اﻵف وخمسمئة واربعة وأربعون فاصلة اربعة وأربعون لا غير
Arqam::wordsNoCurrency('4544.446', 2, 3); //فقط اربعة اﻵف وخمسمئة واربعة وأربعون فاصلة خمسة وأربعون لا غير
Arqam::wordsNoCurrency('8500.789', 2, 3, null, 'ويتضمن كسور بمقدار'); //فقط ثمانية اﻵف وخمسمئة ويتضمن كسور بمقدار تسعة وسبعون لا غير
Arqam::words(15500); //suffix and prefix set to '' in settings, gives: الف وخمسمئة وخمسون ريال سعودي

```

Functions
---------

[](#functions)

**1. words(string $number \[, string $currency, int $decimals, int $precision, bool $roundExceeding, string $outOfRangeMessage, bool $numbersOnly, string $numbersOnlySeparator\]) - Returns a string representing the literal words of the number given as a currency notation**
This function is used to convert a number string to arabic words as a currency notation.

**2. wordsNoCurrency(string $number \[, int $decimals, int $precision, bool $roundExceeding, string $numbersOnlySeparator, string $outOfRangeException\]) - Returns a string representing the literal words of the number without currency notation**
This function is used to convert a number string to arabic words without currency notation.

**3. currency() - Gets the currently set currency**

**4. currencyName() - Gets the currently set currencies name**

**Note:** If you want to use the laravel-arqam functions within your controllers, don't forget to add `use Arqam;` at the beginning of your controller.

```
// Example
