Download the PHP package arraypress/google-address-validation without Composer
On this page you can find all versions of the php package arraypress/google-address-validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arraypress/google-address-validation
More information about arraypress/google-address-validation
Files in arraypress/google-address-validation
Package google-address-validation
Short Description A PHP library for integrating with the Google Address Validation API in WordPress, providing comprehensive address validation, standardization, and verification. Features WordPress transient caching and WP_Error support.
License GPL-2.0-or-later
Homepage https://github.com/arraypress/google-address-validation/
Informations about the package google-address-validation
Google Address Validation API for WordPress
A PHP library for integrating with the Google Address Validation API in WordPress. This library provides robust address validation, standardization, and verification capabilities with support for WordPress transient caching and WP_Error handling.
Features
- ✅ Address Validation: Verify and standardize addresses globally
- 📊 Validation Scoring: Get numerical scores (0-100) and ratings for address quality
- 🏠 Detailed Components: Access all address components and metadata
- 📫 USPS Support: Enhanced validation for US addresses with USPS data
- 🌍 International: Support for addresses worldwide with region code handling
- 🔄 Response Parsing: Clean response object for easy data access
- ⚡ WordPress Integration: Native transient caching and WP_Error support
- 🛡️ Type Safety: Full type hinting and strict types
- 🏢 Business Detection: Identify business locations and PO boxes
- 📍 Geocoding: Get coordinates for validated addresses
- 🔍 Validation Details: Access validation status and issues
Requirements
- PHP 7.4 or later
- WordPress 5.0 or later
- Google Address Validation API key
Installation
Install via Composer:
Basic Usage
Validation Scoring
The library provides a comprehensive scoring system to assess address quality:
Score Components
The validation score considers multiple factors:
- Address completeness (30 points)
- Confirmed components (20 points)
- No inferred components (15 points)
- No replaced components (10 points)
- Geocoding data (10 points)
- Postal code presence (5 points)
- Precise location (5 points)
- USPS validation (5 bonus points for US addresses)
Extended Examples
USPS Validation for US Addresses
Address Type Detection
Working with Address Components
Handling Responses with Caching
API Methods
Client Methods
validate( $address, $region_code = '', $enable_usps = false, $previous_address = false)
: Validate an addressclear_cache( $identifier = null)
: Clear cached responses
Response Methods
Validation Methods
get_score()
: Get numerical validation score (0-100)get_rating()
: Get human-readable validation ratingcheck_validity()
: Get detailed validation analysisis_fully_validated()
: Check if address is completely validatedis_high_confidence()
: Check if address has high confidence validationis_minimal_valid()
: Check if address meets minimal validation requirementsis_standardized()
: Check if address is in standard formatis_exact_match()
: Check if address is an exact match without inferencesis_verification_needed()
: Check if address needs additional verificationis_deliverable()
: Check if address is deliverable (USPS data for US addresses)is_shippable()
: Check if address is valid for shippingis_valid_landmark()
: Check if address is a valid landmark/POIis_us_address()
: Check if address is in the United Stateshas_minimal_components()
: Check if address has required components
Address Properties
is_business()
: Check if address is a business locationis_residential()
: Check if address is residentialis_po_box()
: Check if address is a PO Boxis_active()
: Check if address is active (USPS)is_vacant()
: Check if address is vacant (USPS)is_commercial_mail_receiver()
: Check if address is a CMRA (USPS)
Basic Example
Use Cases
- Address Verification: Validate customer addresses with confidence scores
- Data Standardization: Standardize address data
- USPS Integration: Enhanced US address validation
- Fraud Prevention: Verify address authenticity
- International Support: Validate global addresses
- Business Verification: Identify business locations
- Data Quality: Assess and maintain address data quality with numerical metrics
- Location Services: Support location-based features
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the GPL-2.0-or-later License.