Soenneker.Utils.Libphonenumber 4.0.223

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Utils.Libphonenumber --version 4.0.223
                    
NuGet\Install-Package Soenneker.Utils.Libphonenumber -Version 4.0.223
                    
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.Utils.Libphonenumber" Version="4.0.223" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.Libphonenumber" Version="4.0.223" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.Libphonenumber" />
                    
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.Utils.Libphonenumber --version 4.0.223
                    
#r "nuget: Soenneker.Utils.Libphonenumber, 4.0.223"
                    
#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.Utils.Libphonenumber@4.0.223
                    
#: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.Utils.Libphonenumber&version=4.0.223
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.Libphonenumber&version=4.0.223
                    
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

alternate text is missing from this package README image Soenneker.Utils.Libphonenumber

An async thread-safe singleton for a libphonenumber-csharp instance.

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 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 (3)

Showing the top 3 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.Utils.Test.PhoneNumber

Generates a random valid 10-digit phone number

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
4.0.225 86 8/31/2026
4.0.224 89 8/31/2026
4.0.223 55 8/31/2026
4.0.222 88 8/30/2026
4.0.221 76 8/30/2026
4.0.220 82 8/30/2026
4.0.219 67 8/30/2026
4.0.218 121 8/30/2026
4.0.217 106 8/29/2026
4.0.216 75 8/29/2026
4.0.215 94 8/29/2026
4.0.214 129 8/29/2026
4.0.213 163 8/26/2026
4.0.212 409 8/14/2026
4.0.211 174 8/11/2026
4.0.210 156 8/9/2026
4.0.209 156 8/8/2026
4.0.208 183 8/3/2026
4.0.207 191 7/29/2026
4.0.206 179 7/28/2026
Loading failed

Update dependency Soenneker.Utils.AsyncSingleton to 4.0.829 (#772)