Get PhoneCheck running in 5 minutes!
# Check if you have libphonenumber installed
ldconfig -p | grep phonenumber
# Check Zig version
zig version # Should be 0.15.2 or later# Install dependencies
sudo apt-get update
sudo apt-get install -y libphonenumber-dev libprotobuf-dev libicu-dev
# Build and run
./build_wrapper.sh
zig build run# Install dependencies
brew install libphonenumber protobuf icu4c
# Build and run
./build_wrapper.sh
zig build run# Build image
docker build -t phonecheck .
# Run container
docker run -p 8080:8080 phonecheckOpen another terminal:
# Health check
curl http://localhost:8080/health
# Validate a phone number
curl -X POST http://localhost:8080/validate \
-H "Content-Type: application/json" \
-d '{"phone_number": "+14155552671"}'Expected output:
{
"valid": true,
"possible": true,
"type": "FIXED_LINE_OR_MOBILE",
"country_code": 1,
"national_number": 4155552671,
"region": "US",
"e164_format": "+14155552671",
"international_format": "+1 415-555-2671",
"national_format": "(415) 555-2671",
"possibility_reason": "IS_POSSIBLE"
}# Zig unit tests
zig build test
# API tests (requires server running)
./examples/test_api.sh
# or
python3 examples/test_api.pylibphonenumber not installed. Install it:
# Ubuntu/Debian
sudo apt-get install libphonenumber-dev
# macOS
brew install libphonenumberInstall Zig from https://ziglang.org/download/
Ensure you have a C++ compiler:
# Ubuntu/Debian
sudo apt-get install build-essential
# macOS
xcode-select --install- 📖 Read the full README.md
- 🏗️ Understand the ARCHITECTURE.md
- 🧪 Run more tests with
examples/test_api.py - 🚢 Deploy using the Dockerfile
For production:
# Build with optimizations
zig build -Doptimize=ReleaseFast
# Run the optimized binary
./zig-out/bin/phonecheckGET /healthPOST /validate
Content-Type: application/json
{
"phone_number": "+14155552671",
"region": "US" // optional
}valid: Is the number valid for its region?possible: Is the number theoretically possible?type: MOBILE, FIXED_LINE, TOLL_FREE, etc.country_code: Numeric country code (e.g., 1 for US)national_number: Number without country coderegion: ISO 3166-1 alpha-2 country codee164_format: International standard formatinternational_format: Human-readable internationalnational_format: Local format for the countrypossibility_reason: Why number is/isn't possible
Questions? Check the README.md or open an issue!