Soenneker.Validators.Phone.Possible
4.0.275
Prefix Reserved
dotnet add package Soenneker.Validators.Phone.Possible --version 4.0.275
NuGet\Install-Package Soenneker.Validators.Phone.Possible -Version 4.0.275
<PackageReference Include="Soenneker.Validators.Phone.Possible" Version="4.0.275" />
<PackageVersion Include="Soenneker.Validators.Phone.Possible" Version="4.0.275" />
<PackageReference Include="Soenneker.Validators.Phone.Possible" />
paket add Soenneker.Validators.Phone.Possible --version 4.0.275
#r "nuget: Soenneker.Validators.Phone.Possible, 4.0.275"
#:package Soenneker.Validators.Phone.Possible@4.0.275
#addin nuget:?package=Soenneker.Validators.Phone.Possible&version=4.0.275
#tool nuget:?package=Soenneker.Validators.Phone.Possible&version=4.0.275
Soenneker.Validators.Phone.Possible
Parses phone numbers and checks libphonenumber's region-specific validity metadata.
Install
dotnet add package Soenneker.Validators.Phone.Possible
Registration
using Soenneker.Validators.Phone.Possible.Registrars;
using Microsoft.Extensions.DependencyInjection;
services.AddPhonePossibleValidatorAsSingleton();
Scoped registration is also available. Both registrations reuse the singleton libphonenumber utility, so a scoped validator can be released without rebuilding the shared metadata-backed client.
Parse a number
using PhoneNumbers;
using Soenneker.Validators.Phone.Possible.Abstract;
PhoneNumber? parsed = await validator.Parse(
"+1 312-555-0187",
defaultRegion: "US",
cancellationToken);
The default region is used to interpret national-format input. International input beginning with + carries its own country calling code. Expected libphonenumber parse failures return null; cancellation while obtaining the shared utility and unexpected runtime failures propagate.
Validate raw or parsed input
bool? validRaw = await validator.Validate(
"312-555-0187",
defaultRegion: "US",
cancellationToken);
bool? validParsed = await validator.Validate(
parsed!,
defaultRegion: "US",
cancellationToken);
The raw overload returns false when parsing fails. Both overloads call PhoneNumberUtil.IsValidNumberForRegion; despite the package name, they do not call IsPossibleNumber. Region validity is stricter than a length-only possibility check and requires the parsed number to belong to the requested region.
The nullable Boolean return type is retained by the API, but the current validation implementations return only true or false.
Static access
bool? valid = PhonePossibleValidator.ValidateStatic(parsed!, "US");
The static method uses libphonenumber's process-wide instance directly. Prefer the injected API when consistent dependency ownership and cancellation during lazy initialization matter.
What validity means
Libphonenumber validity means the number matches numbering-plan metadata. It does not prove that the number is assigned, reachable, currently active, or controlled by a user. Use an actual verification flow before trusting ownership.
Metadata can change as numbering plans evolve, so results can differ after dependency updates. Region codes are ISO-style values such as US or GB; invalid region/input combinations fail parsing or validation according to libphonenumber.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Soenneker.Utils.Libphonenumber (>= 4.0.221)
- Soenneker.Validators.Validator (>= 4.0.736)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.275 | 0 | 8/30/2026 |
| 4.0.274 | 0 | 8/30/2026 |
| 4.0.273 | 0 | 8/30/2026 |
| 4.0.272 | 0 | 8/30/2026 |
| 4.0.271 | 27 | 8/30/2026 |
| 4.0.270 | 32 | 8/30/2026 |
| 4.0.269 | 34 | 8/29/2026 |
| 4.0.268 | 40 | 8/29/2026 |
| 4.0.267 | 46 | 8/29/2026 |
| 4.0.266 | 41 | 8/29/2026 |
| 4.0.265 | 40 | 8/29/2026 |
| 4.0.264 | 84 | 8/26/2026 |
| 4.0.263 | 320 | 8/15/2026 |
| 4.0.262 | 94 | 8/12/2026 |
| 4.0.261 | 94 | 8/11/2026 |
| 4.0.260 | 101 | 8/9/2026 |
| 4.0.259 | 89 | 8/8/2026 |
| 4.0.258 | 132 | 8/3/2026 |
| 4.0.257 | 117 | 7/29/2026 |
| 4.0.256 | 119 | 7/28/2026 |
Narrow phone parsing failure handling