Download the PHP package ptplugins/filament-number-input without Composer

On this page you can find all versions of the php package ptplugins/filament-number-input. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-number-input

Filament Number Input

A locale-aware numeric input field for FilamentPHP v3, v4, and v5. The user types and sees a localized number (European 12.345,67 or US 12,345.67); your model always stores a clean float (12345.67).

Single codebase across all three Filament major versions โ€” same field, same API.

Buy us a beer

๐ŸŽฏ Try it live ยท ptplugins.com/demo/number-input โ€” type a number and watch the stored float update.

The problem

Localized number formatting is one of those things that looks trivial and then quietly corrupts your data for a year.

If you let a localized string reach the database โ€” "12.345,67" โ€” everything downstream breaks:

And the naive fix โ€” "just format on the front end" โ€” has its own trap: any value set programmatically (a seeder, an import, $set('amount', '12,34'), a copy/paste) never passes through the browser formatter, so the localized string slips straight into the model.

This field solves both ends. The database only ever sees a plain float, no matter how the value was entered โ€” exactly the same contract as a well-behaved date picker that stores ISO Y-m-d while showing d.m.Y.

How it works โ€” two cooperating layers

  1. Primary layer (JavaScript). An Alpine component formats and parses as the user types. The localized text lives only in formattedValue, which is bound to the input via x-model and never leaves the browser. The only value entangled with the server is rawValue โ€” already a parsed float. In the normal interactive flow, the server never even sees a localized string.

  2. Safety net (PHP). dehydrateStateUsing() runs normalizeToFloat(), and a validation rule guards bad input. This layer exists for values that bypass the browser entirely โ€” programmatic $set(), imports, seeders, paste into a non-rendered field. It is idempotent for anything already numeric: an int/float (or canonical numeric string) is returned unchanged, so it can never corrupt the clean float the JS layer produced. It only does work on a localized string. Both layers read the same separator configuration, so they can never disagree.

Why two layers and not just one? JS alone leaks on programmatic writes; PHP alone means re-implementing locale parsing on the server and giving up live, in-field formatting. Together: live UX and a hard guarantee at the storage boundary.

Installation

The package auto-discovers its service provider. There are no assets to publish โ€” the Alpine logic ships inline with the field's Blade view.

Quick start

That's it. The default is the European convention (dot groups thousands, comma marks decimals). The bound model attribute will be a float.

Configuration

Presets

Custom separators

Method Default Description
decimalSeparator(string\|Closure) , Character shown between integer and decimal part
thousandsSeparator(string\|Closure) . Character grouping thousands
decimalPlaces(int\|Closure) 2 Zero-padding added on blur when the user typed no decimals (12 โ†’ 12,00)
european() โ€” Shortcut for , decimal / . thousands
american() โ€” Shortcut for . decimal / , thousands

All four accept a closure, so separators can depend on the record or the authenticated user's locale.

NumberInput extends Filament's TextInput, so every TextInput method works unchanged โ€” ->required(), ->prefix('โ‚ฌ'), ->suffix('RSD'), ->disabled(), ->placeholder(), affix icons and actions, ->live(), and so on.

Storage guarantee

Whatever the display format, the dehydrated state is a PHP float:

Unparseable input is returned untouched so the validation rule rejects it, rather than silently corrupting the stored value.

Edge cases & gotchas (learned the hard way)

These are the real-world traps we hit running an earlier version of this field across a production Filament app. They're documented here so you don't have to rediscover them.

Filament v3 / v4 / v5

One codebase serves all three. The field extends TextInput (stable across versions) and the Blade view uses only the cross-version <x-filament::input.wrapper> / <x-filament::input> primitives โ€” not the internal markup that Filament reshuffled between v3 and v4. State binding goes through applyStateBindingModifiers, so ->live() / deferred behaviour follows whatever the host version does. Verified against Filament v4.7.2 (view:cache compile) in addition to v3.

Requirements

License

MIT โ€” see LICENSE.md.


Part of the ptplugins.com collection of FilamentPHP plugins.


All versions of filament-number-input with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
filament/filament Version ^3.0 || ^4.0 || ^5.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ptplugins/filament-number-input contains the following files

Loading the files please wait ...