{"id":33988300,"url":"https://github.com/teampickr/php-google-maps-distance-matrix","last_synced_at":"2025-12-13T05:55:44.373Z","repository":{"id":57065894,"uuid":"124913412","full_name":"teampickr/php-google-maps-distance-matrix","owner":"teampickr","description":"PHP Implementation of the Google Maps Distance Matrix API","archived":false,"fork":false,"pushed_at":"2020-10-03T14:52:15.000Z","size":39,"stargazers_count":24,"open_issues_count":4,"forks_count":16,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-10-03T23:55:05.942Z","etag":null,"topics":["distance-matrix","google-maps","google-maps-api","hacktoberfest","laravel","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teampickr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-12T15:49:26.000Z","updated_at":"2025-02-20T09:12:16.000Z","dependencies_parsed_at":"2022-08-24T12:01:07.074Z","dependency_job_id":null,"html_url":"https://github.com/teampickr/php-google-maps-distance-matrix","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/teampickr/php-google-maps-distance-matrix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teampickr%2Fphp-google-maps-distance-matrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teampickr%2Fphp-google-maps-distance-matrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teampickr%2Fphp-google-maps-distance-matrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teampickr%2Fphp-google-maps-distance-matrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teampickr","download_url":"https://codeload.github.com/teampickr/php-google-maps-distance-matrix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teampickr%2Fphp-google-maps-distance-matrix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27621429,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-09T02:00:09.185Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distance-matrix","google-maps","google-maps-api","hacktoberfest","laravel","php"],"created_at":"2025-12-13T05:55:43.844Z","updated_at":"2025-12-13T05:55:44.365Z","avatar_url":"https://github.com/teampickr.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Google Maps Distance Matrix API\n\nThis is a simple package that allows access to the Google Maps Distance Matrix API using a (mostly) fluent API.\nThere is support for both the Standard License and Premium/Enterprise License types provided by Google.\n\n## Installation\n\nInstall the package using composer:\n\n```\n$ composer require teampickr/php-google-maps-distance-matrix\n```\n\n## Frameworks\n\nAt the moment we only have framework compatibility for Laravel. However, we welcome PRs to add further framework\nspecific behavior as long as it doesn't prevent the package working for others, or pull in dependencies that are\nnot optional (suggested).\n\n### Laravel\n\nIf you are using Laravel then you can use our service provider. If you have Laravel \u003e5.5 then the package\nwill be auto discovered upon install. Else, add the following to your `config/app.php` file:\n\n```php\n\u003c?php\n\n'providers' =\u003e [\n    ...\n    \\TeamPickr\\DistanceMatrix\\Frameworks\\Laravel\\DistanceMatrixServiceProvider::class,\n]\n```\n\n#### Facades\n\nPersonally, I hate facades. However, I know people like them. If you are using Laravel \u003e5.5 then the facade will\nbe automatically discovered. Else, you can add it in your `config/app.php` file.\n\n```php\n\u003c?php\n\n'aliases' =\u003e [\n    ...\n    'DistanceMatrix' =\u003e \\TeamPickr\\DistanceMatrix\\Frameworks\\Laravel\\DistanceMatrix::class,\n]\n```\n#### Configuration\n\nFirst, make sure you have copied the configuration file:\n\n```\n$ php artisan vendor:publish --tag=config\n```\n\nThis will make a `config/google.php` file, this is where your API Key / License information is fetched from.\nBy default we use the `.env` configuration values to get your API key.\n\nIf you have a standard api key all you need to add to your `.env` is:\n\n```\nGOOGLE_MAPS_KEY=MY-API-KEY\n```\n\nIf you are a Premium / Enterprise Google Maps user, and use a encryption key and client ID then you should add\nthe following to your `.env`:\n\n```\nGOOGLE_LICENSE_TYPE=premium\nGOOGLE_MAPS_CLIENT_ID=MY-CLIENT-ID\nGOOGLE_MAPS_ENC_KEY=MY-ENCRYPTION-KEY\n```\n\nPlease, make sure you don't store your keys in version control!\n\n## Usage\n\n#### License / API Key\n\nBefore making requests you need to create your License object. If you are a standard google maps user, then all\nyou will need is your API key, then you can create your license as follows:\n\n```php\n$license = new StandardLicense($apiKey);\n```\n\nIf you are a Premium / Enterprise google maps user, then you need to create your license as follows:\n```php\n$license = new PremiumLicense($clientId, $encryptionKey);\n```\n\nThen, you can start making your request:\n\n```php\n$request = new DistanceMatrix($license);\n\n// or\n\n$request = DistanceMatrix::license($license);\n```\n\n#### Basic usage\n\n```php\n$response = DistanceMatrix::license($license)\n    -\u003eaddOrigin('norwich,gb')\n    -\u003eaddDestination('52.603669, 1.223785')\n    -\u003erequest();\n   \n// I want to make the following but of API better,\n// as it looks horrible at the moment.\n$rows = $response-\u003erows();\n$elements = $rows[0]-\u003eelements();\n$element = $element[0];\n\n$distance = $element-\u003edistance();\n$distanceText = $element-\u003edistanceText();\n$duration = $element-\u003eduration();\n$durationText = $element-\u003edurationText();\n$durationInTraffic = $element-\u003edurationInTraffic();\n$durationInTrafficText = $element-\u003edurationInTrafficText();\n\n// or\n\n$response-\u003ejson['destination_addresses'][0];\n$response-\u003ejson['rows'][0]['elements'][0]['distance']['value'];\n$response-\u003ejson['rows'][0]['elements'][0]['duration_in_traffic']['text'];\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteampickr%2Fphp-google-maps-distance-matrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteampickr%2Fphp-google-maps-distance-matrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteampickr%2Fphp-google-maps-distance-matrix/lists"}