Soenneker.Utils.Libphonenumber
11.0.289
Prefix Reserved
dotnet add package Soenneker.Utils.Libphonenumber --version 11.0.289
NuGet\Install-Package Soenneker.Utils.Libphonenumber -Version 11.0.289
<PackageReference Include="Soenneker.Utils.Libphonenumber" Version="11.0.289" />
<PackageVersion Include="Soenneker.Utils.Libphonenumber" Version="11.0.289" />
<PackageReference Include="Soenneker.Utils.Libphonenumber" />
paket add Soenneker.Utils.Libphonenumber --version 11.0.289
#r "nuget: Soenneker.Utils.Libphonenumber, 11.0.289"
#:package Soenneker.Utils.Libphonenumber@11.0.289
#addin nuget:?package=Soenneker.Utils.Libphonenumber&version=11.0.289
#tool nuget:?package=Soenneker.Utils.Libphonenumber&version=11.0.289
Soenneker.Utils.Libphonenumber
Lazily provides libphonenumber-csharp's PhoneNumberUtil for parsing, validating, and formatting international phone numbers.
Installation
dotnet add package Soenneker.Utils.Libphonenumber
Quick start
using Soenneker.Utils.Libphonenumber.Registrars;
services.AddLibphonenumberUtilAsSingleton();
Then inject ILibphonenumberUtil wherever you need it.
Parse, validate, and format
using PhoneNumbers;
PhoneNumberUtil phoneNumbers = await libphonenumberUtil.Get(cancellationToken);
try
{
PhoneNumber number = phoneNumbers.Parse("(212) 555-0100", "US");
if (phoneNumbers.IsValidNumber(number))
{
string e164 = phoneNumbers.Format(number, PhoneNumberFormat.E164);
// +12125550100
}
}
catch (NumberParseException)
{
// The input could not be interpreted as a phone number.
}
Pass an ISO 3166-1 alpha-2 region such as "US" when parsing a national number. For an input
already beginning with + and a country calling code, the region can be null. Parsing only
interprets the text; call IsPossibleNumber or IsValidNumber when validity matters.
Get lazily returns the shared PhoneNumberUtil supplied by libphonenumber-csharp. Cache the
returned reference within an operation if you need it repeatedly. The cancellation token applies
while obtaining the lazy value; it does not affect later synchronous parsing or formatting calls.
The scoped registrar is available when the wrapper must follow a scope, but the underlying
libphonenumber instance remains shared. Let dependency injection dispose the wrapper; callers do
not own the returned PhoneNumberUtil.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- libphonenumber-csharp (>= 9.0.43)
- Soenneker.Utils.AsyncSingleton (>= 11.0.896)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Soenneker.Utils.Libphonenumber:
| Package | Downloads |
|---|---|
|
Soenneker.Validators.Phone.Possible
A validation module checking if a given phone number is possible |
|
|
Soenneker.Phone.Util
Parses, validates, and formats phone numbers as E.164 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.289 | 0 | 11/18/2026 |
| 11.0.288 | 0 | 11/18/2026 |
| 11.0.287 | 10 | 11/18/2026 |
| 11.0.286 | 216 | 11/11/2026 |
| 11.0.285 | 128 | 11/11/2026 |
| 11.0.284 | 106 | 11/11/2026 |
| 11.0.283 | 97 | 11/11/2026 |
| 11.0.282 | 157 | 11/10/2026 |
| 11.0.281 | 188 | 11/7/2026 |
| 11.0.280 | 243 | 11/3/2026 |
| 11.0.279 | 263 | 10/27/2026 |
| 11.0.277 | 148 | 10/26/2026 |
| 11.0.276 | 115 | 10/26/2026 |
| 11.0.275 | 122 | 10/26/2026 |
| 11.0.274 | 117 | 10/26/2026 |
| 11.0.273 | 98 | 10/26/2026 |
| 11.0.272 | 97 | 10/26/2026 |
| 4.0.271 | 166 | 10/25/2026 |
| 4.0.270 | 511 | 10/15/2026 |
| 4.0.269 | 110 | 10/15/2026 |
Update dependency Soenneker.Utils.AsyncSingleton to 11.0.896 (#899)