Download the PHP package opencleancode/php-google-matrix-distance-api-client without Composer

On this page you can find all versions of the php package opencleancode/php-google-matrix-distance-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-google-matrix-distance-api-client

PHP Client for Google Distance Matrix API

The Google Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations. The information returned is based on the recommended route between start and end points, as calculated by the Google Maps API, and consists of rows containing duration and distance values for each pair.

Please refer to Google Distance Matrix API documentation for further details on request parameters and response format.

Installation

composer require opencleancode/php-google-matrix-distance-api-client

Basic Usage
   $distanceMatrix = new DistanceMatrix();

    $distanceMatrix->setOrigins('Vancouver, BC, Canada | Seattle, État de Washington, États-Unis')
        ->setDestinations('San Francisco, Californie | États-Unis,Victoria, BC, Canada')
        ->setUnits(Unit::IMPERIAL);

    $matrixClient = new GoogleMapsMatrixApiClient(self::API_KEY);
    $result = $matrixClient->request($distanceMatrix)->getResults();

            $result->getStatus();
            $result->getDestinationAddresses();
            $result->getOriginAddresses();

            /** @var Item $item */
            foreach ($result->getItems() as $item){

                    $item->getStatus();
                    $item->getDestinationAddress();
                    $item->getOriginAddress();
                    $item->getDistance()->getValue();
                    $item->getDistance()->getUnitValue();
                    $item->getDuration()->getValue();
                    $item->getDuration()->getUnitValue();
            }
Request Parameters Options
Field Type Description Required
origins string Origin Point Coordinate or Place Name True
destinations string Destinations Point Coordinate or Place Name True
mode string Travel Mode (driving,walking etc.) False
language string Response Language False
unit string Distance unit False
trafficModel string Traffic Type (best_guess,pessimistic) False
Response Fields
Field Type Description
status string Api response status type OK , FAILED etc.
originAddresses array Origin Addresses list
destinationsAddresses array Destinations Addresses list
items array Response Items
Response Item Fields
Field Type Description
distance object Distance unformatted value and unit value
duration object Durations unformatted value and unit value
status string Status OK , FAILED
originAddress string Single Origin Address
destinationAddress string Single Destination Address
Example Response

example response

TODO

All versions of php-google-matrix-distance-api-client with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-curl Version *
ext-json Version *
phpunit/phpunit Version 8.5.23
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package opencleancode/php-google-matrix-distance-api-client contains the following files

Loading the files please wait ....