Download the PHP package curiousyigit/laravel-arqam without Composer
On this page you can find all versions of the php package curiousyigit/laravel-arqam. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download curiousyigit/laravel-arqam
More information about curiousyigit/laravel-arqam
Files in curiousyigit/laravel-arqam
Package laravel-arqam
Short Description laravel-arqam is a laravel packages that converts numbers to arabic words
License MIT
Homepage https://github.com/curiousyigit/laravel-arqam
Informations about the package laravel-arqam
ABANDONED
This project is abondened and no longer maintained.
laravel-arqam
laravel-arqam helps you convert numbers to arabic words
Installation
Installation is straightforward, setup is similar to every other Laravel Package.
1. Install via composer
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.
Then we want to define an alias in the same config/app.php
file.
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:
This generates a config file at config/arqam.php.
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
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:
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.
Configurables
You can configure various properties from the config/laravel-arqam.php
file.
Contribute
I encourage you to contribute to this package to improve it and make it better. Even if you don't feel comfortable with coding or submitting a pull-request (PR), you can still support it by submitting issues with bugs or requesting new features, or simply helping discuss existing issues to give us your opinion and shape the progress of this package. Best regards!
Planned (Help if you can!)
- Add thousands separator support
- Add different decimal separator support