Download the PHP package visual1au/statamic-phone-fieldtype without Composer
On this page you can find all versions of the php package visual1au/statamic-phone-fieldtype. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download visual1au/statamic-phone-fieldtype
More information about visual1au/statamic-phone-fieldtype
Files in visual1au/statamic-phone-fieldtype
Package statamic-phone-fieldtype
Short Description A Statamic fieldtype for phone number validation and E.164 formatting using Laravel-Phone with Australia-first detection
License MIT
Homepage https://github.com/visual1au/statamic-phone-fieldtype
Informations about the package statamic-phone-fieldtype
Statamic Phone Number Fieldtype
A Statamic fieldtype for phone number validation and E.164 formatting using Laravel-Phone. Perfect for forms and collections that need consistent phone number handling with Australia-first detection.
Features
- ✅ Multi-format Input: Accepts various phone formats (0412 345 678, (07) 3210 1234, +61 412 345 678, +1 555 123 4567)
- ✅ Australia-first Validation: Validates phone numbers using Laravel-Phone with Australia-first detection
- ✅ E.164 Normalisation: Automatically converts valid numbers to E.164 format (e.g. +12345678901)
- ✅ Form Compatible: Works in Statamic forms with custom validation messages
- ✅ Integration Ready: Ensures consistent format for Zapier, HubSpot, and other integrations
- ✅ User-Friendly: Clear error messages with international format examples
Installation
Install via Composer:
Requirements
- PHP 8.1+
- Statamic 4.0+ or 5.0+
- Laravel-Phone 5.0+ or 6.0+
The package automatically installs propaganistas/laravel-phone if not already present.
Configuration
Environment Variables
You can configure the phone number validation behavior using environment variables in your .env file:
Publishing Configuration
To customise the configuration, publish the config file:
This will create config/phone-fieldtype.php where you can modify:
Configuration Options
primary_country: The primary country code to use for validation (default:AU)auto_fallback: Enable automatic fallback detection if primary country fails (default:true)
Usage
In Forms
Add the field to your form blueprint:
In Collections
Add to any collection blueprint:
Configuration Options
The fieldtype supports standard text field options:
placeholder: Placeholder textdefault: Default valueprepend: Text to prependappend: Text to append
How It Works
-
User Input: User enters phone number in various formats
0412 345 678(Australian mobile)(07) 3210 1234(Australian landline)+61 412 345 678(Australian international)+1 555 123 4567(International)
-
Validation: Built-in validation with friendly error messages
- Prioritises primary country format detection first (configurable, defaults to AU)
- Falls back to international auto-detection (if enabled)
- Shows clear error: "Please enter a valid phone number (e.g. 0412 345 678, (07) 3210 1234, +61 412 345 678, +1 555 123 4567)."
-
Processing: Converts to E.164 format for storage
- All formats → E.164 (e.g.
+12345678901) - Consistent data for integrations
- Maintains original input validation
- All formats → E.164 (e.g.
- Integration: Perfect for external services
- Zapier webhooks receive normalised format
- HubSpot integration without format issues
- API endpoints get consistent data structure
Example Data Flow
Error Handling
Invalid inputs show user-friendly messages:
Development
To contribute or modify:
- Clone the repository
- Install dependencies:
composer install - Make changes to
src/Fieldtypes/PhoneNumberField.php - Test in a Statamic project
Changelog
1.0.0
- Initial release
- Phone number validation and E.164 formatting with Australia-first detection
- Support for Australian local and international formats
- Form and collection support
- Custom validation messages
License
MIT License. See LICENSE for details.
Support
Credits
Built with:
- Statamic CMS
- Laravel-Phone
- libphonenumber (via Laravel-Phone)
All versions of statamic-phone-fieldtype with dependencies
statamic/cms Version ^4.0|^5.0
propaganistas/laravel-phone Version ^5.0|^6.0