PHP code example of ptplugins / filament-number-input

1. Go to this page and download the library: Download ptplugins/filament-number-input 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/ */

    

ptplugins / filament-number-input example snippets


use PtPlugins\FilamentNumberInput\Fields\NumberInput;

NumberInput::make('price');

NumberInput::make('price')->european(); // 12.345,67  (default)
NumberInput::make('price')->american(); // 12,345.67

NumberInput::make('price')
    ->decimalSeparator(',')
    ->thousandsSeparator(' ') // e.g. "12 345,67"  (French / SI style)
    ->decimalPlaces(2);

NumberInput::make('price')->european(); // user sees 1.234,56 → model stores 1234.56
NumberInput::make('price')->american(); // user sees 1,234.56 → model stores 1234.56

// And directly, for imports/seeders, the same parsing is available:
NumberInput::make('price')->european()->normalizeToFloat('1.234,56'); // 1234.56
NumberInput::make('price')->american()->normalizeToFloat('1,234.56'); // 1234.56
NumberInput::make('price')->normalizeToFloat(1234.56);                 // 1234.56 (unchanged)
NumberInput::make('price')->normalizeToFloat('');                      // null