Guides
Validate on the server
Never trust the browser. The core runs without a DOM, so you can validate the same way on the server.
Node, Bun, Deno, edge functions
import '@devix-labs/phone-input/metadata/all'; // every region, ~48 KB gzipped, loaded once
import { inspect } from '@devix-labs/phone-input/core';
const result = inspect(request.body.phone, { defaultRegion: 'AE', allowedTypes: ['mobile'] });
if (!result.valid) {
return error(result.reason); // "too_short", "not_allowed_type", …
}
save({ phone: result.e164, country: result.region, type: result.type });
Laravel
The same metadata ships as metadata.json. Laravel Phone (a separate Devix package) reads it,
so your server and your form can never disagree about what counts as valid.
Store E.164
Store result.e164 (+971501234567). It is unambiguous, sortable, searchable and what every SMS or
calling API expects. Format for display at read time with format().
Updated 15 Sep 2026