Phone Number Fieldtype Icon

Phone Number Fieldtype

2.0.1

August 18th, 2026

Adds the addon's first test coverage — previously every bug fixed in 2.0.0 was only caught by manual testing.

  • PHPUnit suite (tests/, vendor/bin/phpunit): unit/feature tests for the fieldtype, controller, both modifiers, and service provider registration, run via Orchestra Testbench and Statamic's AddonTestCase. Includes direct regression tests: sequential locale requests within a single test process (catches the gettext caching bug from 2.0.0 if it ever comes back), and a feature test building real entries and running the listing filter end-to-end (catches the isComplete() fatal error).
  • Playwright suite (tests-e2e/, npm run test:e2e): end-to-end tests driving a real Control Panel and front end in a browser, against a disposable Statamic site scaffolded inside the repo via Testbench's "workbench" feature (workbench/, testbench.yaml) rather than depending on an external install. Covers field rendering, the save/reload round-trip, CP locale handling, the listing filter, and front-end modifier rendering.
  • TESTING.md: documents how to run both suites and what tests-e2e/setup-workbench.sh does to get a plain Testbench workbench booting a fully working Statamic site — none of it is default Testbench behavior: seeding Statamic's addon manifest directly (it only recognizes installed dependencies, never the root package being tested), mirroring composer.lock into the skeleton for the CP's licensing check, and switching the skeleton to file-based users with Statamic's own statamic auth driver (Laravel's default eloquent driver silently rejects correct file-based credentials).

Both fixed bugs from 2.0.0 (the listing-filter fatal error and the locale-caching bug) were spot-checked by temporarily reintroducing them and confirming the new tests actually fail, then reverting.

2.0.0

August 17th, 2026

Migrates the Control Panel fieldtype to Statamic 6, which was completely broken before this branch — the CP would show "Component phone_number-fieldtype does not exist" for any blueprint using the field, because the compiled bundle referenced a bare global Fieldtype mixin and other Vue 2-era APIs that no longer exist in Statamic 6's Vue 3 Control Panel.

Breaking: composer.json now requires statamic/cms: ^6.0. This version will not install on Statamic 3-5.

  • Rebuilt the CP fieldtype component (resources/js/components/fieldtypes/PhoneNumberFieldtype.vue) using Vue 3's Composition API: import { Fieldtype } from '@statamic/cms' instead of the old bare global, import { Input } from '@statamic/cms/ui' for the input itself, and update(value) instead of this.$emit('input', value) to match the current fieldtype contract.
  • Replaced the Laravel Mix/webpack build with Vite (vite.config.js, @statamic/cms/vite-plugin, laravel-vite-plugin), matching Statamic's current addon tooling. Built assets are committed under resources/dist/build so installing the addon doesn't require a Node toolchain.
  • Fixed a fatal error (Call to undefined method PhoneNumberFieldtypeFilter::isComplete()) when applying or changing the field's filter in a collection listing. Statamic 6 requires filter classes to implement isComplete(); rather than patch the addon's own filter — which only duplicated Statamic's built-in one, minus its operator ("Contains"/"Is"/"Isn't"/etc.) selector — removed the PhoneNumberFieldtype::filter() override entirely so it now uses Statamic's own FieldtypeFilter.
  • Fixed the {lang}/countries route always returning English country names regardless of the requested locale, plus a deeper issue underneath it: sokil/php-isocodes's default gettext-based driver caches translations at the process level, so once one locale's catalog loaded, every later request in that PHP worker kept returning it no matter what locale was actually requested. Switched both PhoneNumberFieldtypeController::getCountries() and the fieldtype's config-panel country list to sokil/php-isocodes's SymfonyTranslationDriver, which loads translations per-instance instead of through global setlocale() state.
  • Cut the JS bundle loaded on every Control Panel page from ~292KB (70KB gzipped) to ~42KB (15KB gzipped) by lazy-loading intl-tel-input's validation library (utils.js, ~250KB) again, only when a phone number field actually mounts, instead of bundling it directly into the main script.

1.0.3

May 20th, 2023

README-only release, no code changes. Reworded the features list into bold-labeled bullet points (e.g. "E164 Format: ...") instead of plain sentences, and rewrote several usage-example paragraphs (fieldtype configuration, modifier examples) for clarity.