PHP code example of padmission / number-no-intl

1. Go to this page and download the library: Download padmission/number-no-intl 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/ */

    

padmission / number-no-intl example snippets


use Illuminate\Support\Number;

// Format a number
echo Number::format(1234.56, 2); // "1,234.56"

// Format as currency
echo Number::currency(1234.56, 'USD'); // "$1,234.56"

// Format as percentage
echo Number::percentage(75.5); // "76%"

// Format for humans
echo Number::forHumans(1234567); // "1.23 million"

// Format abbreviated
echo Number::abbreviate(1234567); // "1.23M"

return [
    // Default locale to use for formatting (only 'en' is fully supported)
    'locale' => env('NUMBER_NO_INTL_LOCALE', 'en'),

    // Default currency to use
    'currency' => env('NUMBER_NO_INTL_CURRENCY', 'USD'),

    // Whether to automatically replace Laravel's Number class
    // when the intl extension is not available
    'auto_replace' => env('NUMBER_NO_INTL_AUTO_REPLACE', true),
];
bash
php artisan vendor:publish --tag="number-no-intl-config"