Soenneker.Validators.Phone.Possible 4.0.277

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Validators.Phone.Possible --version 4.0.277
                    
NuGet\Install-Package Soenneker.Validators.Phone.Possible -Version 4.0.277
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Validators.Phone.Possible" Version="4.0.277" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Validators.Phone.Possible" Version="4.0.277" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Validators.Phone.Possible" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Validators.Phone.Possible --version 4.0.277
                    
#r "nuget: Soenneker.Validators.Phone.Possible, 4.0.277"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Validators.Phone.Possible@4.0.277
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Validators.Phone.Possible&version=4.0.277
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Validators.Phone.Possible&version=4.0.277
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.279 0 9/1/2026
4.0.278 33 8/31/2026
4.0.277 36 8/31/2026
4.0.276 41 8/31/2026
4.0.275 37 8/30/2026
4.0.274 34 8/30/2026
4.0.273 69 8/30/2026
4.0.272 46 8/30/2026
4.0.271 44 8/30/2026
4.0.270 40 8/30/2026
4.0.269 38 8/29/2026
4.0.268 45 8/29/2026
4.0.267 49 8/29/2026
4.0.266 43 8/29/2026
4.0.265 43 8/29/2026
4.0.264 86 8/26/2026
4.0.263 329 8/15/2026
4.0.262 94 8/12/2026
4.0.261 94 8/11/2026
4.0.260 101 8/9/2026
Loading failed

Update dependency Soenneker.Utils.Libphonenumber to 4.0.224 (#821)