PHP code example of codemarkt / laravel-number-to-words
1. Go to this page and download the library: Download codemarkt/laravel-number-to-words library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
codemarkt / laravel-number-to-words example snippets
// Convert numbers to words
number_to_words(154); // Uses default locale from config
number_to_words(154, 'tr'); // "yüz elli dört"
number_to_words(154, 'en'); // "one hundred fifty four"
// Convert currency amounts
number_to_currency_words(8097.21, 'TRY', 'tr'); // "sekiz bin doksan yedi türk lirası yirmi bir kuruş"
number_to_currency_words(150.50, 'USD', 'en'); // "one hundred fifty us dollar fifty cent"
// With custom formatting
number_to_words(123, 'tr', 'uppercase', '-'); // "YÜZ-YİRMİ-ÜÇ"
use CodeMarkt\NumberToWords\Facades\NumberToWords;
// Or use the global alias (automatically registered)
use NumberToWords;
NumberToWords::toWords(154, 'tr'); // "yüz elli dört"
NumberToWords::toCurrency(8097.21, 'TRY', 'tr'); // "sekiz bin doksan yedi türk lirası yirmi bir kuruş"