Quarkus extension for Google's libphonenumber. It provides an injectable PhoneNumberUtil and a @PhoneNumber bean validation constraint. It also bundles the libphonenumber metadata into native images.
Status: pre-release, nothing is published yet. Use 0.1.0-SNAPSHOT from a local mvn install.
Maven:
<dependency>
<groupId>org.sitenetsoft</groupId>
<artifactId>quarkus-libphonenumber</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>Gradle:
implementation 'org.sitenetsoft:quarkus-libphonenumber:0.1.0-SNAPSHOT'@Inject
PhoneNumberUtil util;
public record Signup(
@NotNull
@PhoneNumber(regions = { "CA", "US" }, types = { MOBILE, FIXED_LINE_OR_MOBILE })
String phone) {
}regionsandtypesempty mean any.nullis valid, so pair the constraint with@NotNull.quarkus.libphonenumber.default-region=CAlets users type a number without a+.- Canadian and US mobile numbers report
FIXED_LINE_OR_MOBILE; list it next toMOBILE.
- Documentation.
mvn package -Pdocsbuilds it intodocs/target/generated-docs/.
JAVA_HOME=/path/to/jdk-25 mvn -T 4 verifyThe native integration test runs with -Dnative. See Native.
Releasing describes the release procedure, its secrets and the local rehearsal.