Download the PHP package erlenwald/filament-phone-input without Composer

On this page you can find all versions of the php package erlenwald/filament-phone-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-phone-input

Filament Phone Input

A Filament form field for entering phone numbers with country selection, masks, country detection, configurable output formats, and optional flag icons.

Features

Requirements

Installation

Install the package via Composer:

Publish the required flag assets:

Publish Filament assets:

Clear the application cache if needed:

Optional publishing

You can publish only the files you need.

Tag Publishes
filament-phone-input-assets Flag atlas files to public/vendor/erlenwald/filament-phone-input/flags
filament-phone-input-translations Translation files to lang/vendor/erlenwald-filament-phone-input
filament-phone-input-styles Custom CSS file to resources/css/vendor/erlenwald/filament-phone-input/phone-input.css
filament-phone-input-customization Translations and custom CSS
filament-phone-input-full Flags, translations, and custom CSS

Publish everything:

Publish everything and overwrite existing files:

Use --force carefully because it overwrites already published translations and custom CSS.

After publishing or changing custom CSS, run:

Basic usage

By default, the normalized phone number is written to the same state path as the field name:

To also store the selected country ISO2 code:

Submitted state:

Full example

Configuration methods

Method Description
phoneStatePath(string\|Closure\|null $path) Overrides the state path where the normalized phone number is written. If not set, the field state path is used.
countryStatePath(string\|Closure\|null $path = 'phone_country') Enables writing the selected country ISO2 code to form state. If called without arguments, writes to phone_country.
countries(array\|Closure\|null $countries = null) Restricts the visible country list. If not set, all supported countries are displayed.
favoriteCountries(array\|Closure\|null $countries = null) Displays selected countries in a separate group at the top of the dropdown.
defaultCountry(string\|Closure\|null $country) Sets the initial fallback country. Does not restrict the country list.
displayCountryFlag(bool\|Closure $condition = true) Displays flag icons instead of ISO2 country codes.
flagAspect(string\|Closure $aspect) Sets the flag aspect ratio. Supported values: '4x3', '1x1'.
phoneNumberFormat(PhoneNumberFormat\|string\|Closure $format) Sets the submitted phone number format.
enableIpLookup(bool\|Closure $condition = true) Enables IP lookup without changing the configured endpoint.
ipLookup(string\|Closure\|null $url = null, string\|Closure\|null $countryKey = 'country_code') Configures and enables IP lookup.

All standard Filament field methods such as required(), label(), helperText(), disabled(), and hidden() are available because the component extends Filament's Field.

Phone number formats

Use the PhoneNumberFormat enum:

Available formats:

Enum Value Example
PhoneNumberFormat::E164 e164 +[country_code][national_number]
PhoneNumberFormat::National national 8 (XXX) XXX-XX-XX
PhoneNumberFormat::International international +[country_code] (XXX) XXX-XX-XX
PhoneNumberFormat::Rfc3966 rfc3966 tel:+[country_code][national_number]
PhoneNumberFormat::Digits digits [country_code][national_number]
PhoneNumberFormat::NationalDigits national_digits [national_number]

You can also pass a string:

State paths

Default phone state

Submitted state:

Phone and country state

Submitted state:

Custom country state path

Submitted state:

Custom phone state path

Submitted state:

Countries

Restrict visible countries:

Show favorite countries at the top:

Set an initial fallback country:

defaultCountry() does not restrict the list. It is only used as an initial fallback when the field is empty and no country state is available.

Flags

By default, the component displays ISO2 country codes.

Enable flag icons:

Use rectangular flags:

Use square flags:

Flag icons require published flag assets:

The package ships both WebP and SVG flag atlases.

By default, WebP atlases are used because they are much smaller:

Atlas SVG size WebP size
atlas-1x1 ~1.5 MB ~188 KB
atlas-4x3 ~1.5 MB ~210 KB

If you prefer SVG atlases, publish the custom CSS file:

Then edit:

and override the flag atlas variables:

After changing custom CSS, run:

IP lookup

IP lookup is optional and does not override a value already typed by the user.

The endpoint may return JSON:

Nested keys are supported:

Expected JSON:

Plain text is also supported:

Cloudflare-like trace text is supported too:

Customization

Translations

Publish translations:

Published files:

You can edit these files to override labels, country names, search placeholder, and group names.

Styles

Publish custom CSS:

Published file:

This file is loaded after the package CSS, so you can override component styles and CSS variables there.

After changing the custom CSS, run:

Validation

This package focuses on input formatting and state normalization.

Server-side validation should still be handled by your application according to your own business rules:

Assets

The component uses generated flag atlas files.

WebP atlases are used by default:

SVG atlases are also included and can be enabled through custom CSS:

All flag atlases are published to:

The base JavaScript and CSS assets are registered through Filament:

After package updates, refresh published assets:

If you also want to refresh translations and custom CSS, use:

Be careful: this overwrites customized translation and CSS files.

Credits

Flag assets are based on the flag-icons project.

See NOTICE.md for third-party attribution.

License

The MIT License.

See LICENSE.


All versions of filament-phone-input with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^5.0
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 erlenwald/filament-phone-input contains the following files

Loading the files please wait ...