Download the PHP package arraypress/google-distance-matrix without Composer
On this page you can find all versions of the php package arraypress/google-distance-matrix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download arraypress/google-distance-matrix
More information about arraypress/google-distance-matrix
Files in arraypress/google-distance-matrix
Download arraypress/google-distance-matrix
More information about arraypress/google-distance-matrix
Files in arraypress/google-distance-matrix
Vendor arraypress
Package google-distance-matrix
Short Description A PHP library for integrating with the Google Distance Matrix API in WordPress, providing travel distance and time calculations between multiple origins and destinations. Features WordPress transient caching and WP_Error support.
License GPL-2.0-or-later
Homepage https://github.com/arraypress/google-distance-matrix/
Package google-distance-matrix
Short Description A PHP library for integrating with the Google Distance Matrix API in WordPress, providing travel distance and time calculations between multiple origins and destinations. Features WordPress transient caching and WP_Error support.
License GPL-2.0-or-later
Homepage https://github.com/arraypress/google-distance-matrix/
Please rate this library. Is it a good library?
Informations about the package google-distance-matrix
Google Distance Matrix API for WordPress
A PHP library for integrating with the Google Distance Matrix API in WordPress. This library provides robust distance and time calculations between multiple origins and destinations with support for WordPress transient caching and WP_Error handling.
Features
- π Distance Calculations: Calculate distances between multiple origins and destinations
- β±οΈ Travel Times: Get accurate travel duration with traffic considerations
- π Multiple Modes: Support for driving, walking, cycling, and transit modes
- π International: Support for distance calculations worldwide
- π Unit Flexibility: Support for both metric and imperial measurements
- π 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
- π¦ Traffic Data: Optional real-time traffic consideration
- πΊοΈ Route Options: Support for route restrictions and preferences
- π Fluent Interface: Chainable methods for setting options
Requirements
- PHP 7.4 or later
- WordPress 6.7.1 or later
- Google Distance Matrix API key
Installation
Install via Composer:
Basic Usage
Setting Default Options
Multiple Origins/Destinations
Available Options
Travel Modes
Units
Avoid Options
Traffic Models
Default Options
Working with Options Array
Handling Responses with Caching
API Methods
Client Methods
Option Setters
set_mode( string $mode )
: Set travel modeset_units( string $units )
: Set distance unitsset_avoid(?string $avoid )
: Set features to avoidset_language( string $language )
: Set response languageset_traffic_model(?string $model )
: Set traffic modelreset_options()
: Reset all options to defaults
Core Methods
calculate( $origins, $destinations, $options = [] )
: Calculate distancesclear_cache( $identifier = null )
: Clear cached responses
Response Methods
Distance Methods
get_distance( $origin_index, $destination_index )
: Get distance data for specific pairget_duration( $origin_index, $destination_index )
: Get duration data for specific pairget_formatted_distance( $origin_index, $destination_index )
: Get formatted distance stringget_formatted_duration( $origin_index, $destination_index )
: Get formatted duration stringget_distance_meters( $origin_index, $destination_index )
: Get distance in metersget_duration_seconds( $origin_index, $destination_index )
: Get duration in seconds
Data Access Methods
get_origins()
: Get array of origin addressesget_destinations()
: Get array of destination addressesget_all_distances()
: Get all calculated distances in array formatget_element( $origin_index, $destination_index )
: Get specific matrix elementget_element_status( $origin_index, $destination_index )
: Get status of specific calculationis_complete()
: Check if all calculations were successfulfind_nearest_destination( $origin_index )
: Find nearest destination to specific origin
Use Cases
- Delivery Planning: Calculate delivery routes and times
- Shipping Costs: Distance-based shipping calculations
- Service Areas: Define and check service coverage areas
- Route Optimization: Find optimal routes for multiple destinations
- Travel Time Estimation: Accurate travel time calculations
- Fleet Management: Support for vehicle routing and planning
- Coverage Analysis: Analyze service area coverage
- Location Planning: Optimize location selection based on distance
- E-commerce Shipping: Calculate shipping costs based on distance
- Service Radius: Define service areas with time/distance constraints
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.
Support
All versions of google-distance-matrix with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.4
The package arraypress/google-distance-matrix contains the following files
Loading the files please wait ....