Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	composer.json
#	examples/example-all-parameters.php
#	examples/example-basic.php
#	src/GoogleMapsTimeZone.php
  • Loading branch information
Iván Melgrati committed Feb 25, 2018
2 parents 10162cd + f662857 commit daa60b6
Show file tree
Hide file tree
Showing 6 changed files with 679 additions and 5 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ google-time-zone
[![Latest Stable Version](https://poser.pugx.org/imelgrat/google-time-zone/v/stable)](https://packagist.org/packages/imelgrat/google-time-zone)
[![Total Downloads](https://poser.pugx.org/imelgrat/google-time-zone/downloads)](https://packagist.org/packages/imelgrat/google-time-zone)

<<<<<<< HEAD
A PHP wrapper for the Google Maps TimeZone API.

The Google Maps Time Zone API provides a simple interface to request the time zone for a location on the earth, as well as that location's time offset from UTC.
Expand All @@ -15,6 +16,11 @@ The class automates the query process and returns the name of that time zone (in


Developed by [Ivan Melgrati](https://imelgrat.me)
=======
A PHP wrapper for the Google Maps Time Zone API.

Developed by [Ivan Melgrati](https://imelgrat.me) [![Twitter](https://img.shields.io/twitter/url/https/github.com/imelgrat/tab-collapse.svg?style=social)](https://twitter.com/imelgrat)
>>>>>>> origin/master
Requirements
------------
Expand Down Expand Up @@ -43,7 +49,7 @@ The recommended installation method is through

### Manually

1. Copy `src/google-time-zone.php` to your codebase, perhaps to the `vendor`
1. Copy `src/GoogleMapsTimeZone.php` to your codebase, perhaps to the `vendor`
directory.
2. Add the `GoogleMapsTimeZone` class to your autoloader or `require` the file
directly.
Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "imelgrat/google-time-zone",
"type": "library",
<<<<<<< HEAD
"version" : "1.4.0",
"description": "A PHP wrapper for the Google Maps TimeZone API.",
=======
"description": "A PHP wrapper for the Google Maps Time Zone API.",
>>>>>>> origin/master
"keywords": ["google", "map", "maps", "gmap", "gmaps", "timezone", "time zone", "location"],
"homepage": "https://github.com/imelgrat/google-time-zone",
"license": "MIT",
Expand Down
66 changes: 65 additions & 1 deletion examples/example-all-parameters.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
<<<<<<< HEAD
/**
* This section includes a sample query that demonstrate features of the API.
* The code below query performs a time zone request for Github's server (San Francisco, California, United States). The timestamp is set to March 8th, 2012.
Expand Down Expand Up @@ -58,4 +59,67 @@
echo '<pre>';
var_dump($timezone_data);
echo '</pre>';
?>
?>
=======

/**
* This section includes a sample query that demonstrate features of the API.
* The code below query performs a time zone request for Github's server (San Francisco, California, United States). The timestamp is set to March 8th, 2012.
*
* @author Ivan Melgrati
* @copyright 2016
* @package GoogleMapsTimeZone
* @author Ivan Melgrati
* @version v1.2.0 stable
*/

require_once('../src/GoogleMapsTimeZone.php');

/**
* All queries require an API key from Google.
* @link https://developers.google.com/maps/documentation/timezone/get-api-key
*/
define('API_KEY', 'YOUR API KEY HERE');

// Create GoogleMapsTimeZone object with default properties.
$timezone_object = new GoogleMapsTimeZone();

// Set Google API key.
$timezone_object->setApiKey(API_KEY);

// Set XML as query return format.
$timezone_object->setFormat($timezone_object::FORMAT_XML);

// Set Spanish as query return language.
// Check https://developers.google.com/maps/faq#languagesupport for a list of supported languages
$timezone_object->setLanguage('es');

// Set latitude (Mexico City International Airport).
$timezone_object->setLatitude(19.4360812);

// Set longitude (Mexico City International Airport).
$timezone_object->setLongitude(-99.074097);

// Set Timestamp (server-side current time).
$timezone_object->setTimestamp(time());

// Perform query
$timezone_data = $timezone_object->queryTimeZone();

echo '<pre>';
print_r($timezone_data);
echo '</pre>';

// Set XML as query return format.
$timezone_object->setFormat($timezone_object::FORMAT_JSON);
// Set Arabic as query return language.
// Checkhttps://developers.google.com/maps/faq#languagesupport for a list of supported languages
$timezone_object->setLanguage('ar');

// Perform query.
$timezone_data = $timezone_object->queryTimeZone();

echo '<pre>';
var_dump($timezone_data);
echo '</pre>';
>>>>>>> origin/master
37 changes: 36 additions & 1 deletion examples/example-basic.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
<<<<<<< HEAD
/**
* This section includes a sample query that demonstrate features of the API.
* The code below query performs a time zone request for Github's server (San Francisco, California, United States). The timestamp is set to March 8th, 2012.
Expand Down Expand Up @@ -30,4 +31,38 @@
echo '<pre>';
print_r($timezone_data);
echo '</pre>';
?>
?>
=======

/**
* This section includes a sample query that demonstrate features of the API.
* The code below query performs a time zone request for Github's server (San Francisco, California, United States). The timestamp is set to March 8th, 2012.
*
* @author Ivan Melgrati
* @copyright 2016
* @package GoogleMapsTimeZone
* @author Ivan Melgrati
* @version v1.2.0 stable
*/

require_once('../src/GoogleMapsTimeZone.php');

/**
* All queries require an API key from Google.
* @link https://developers.google.com/maps/documentation/timezone/get-api-key
*/
define('API_KEY', 'YOUR API KEY HERE');

// Initialize GoogleMapsTimeZone object.
$timezone_object = new GoogleMapsTimeZone(37.7697, -122.3933, 1331161200, GoogleMapsTimeZone::FORMAT_JSON);

// Set Google API key.
$timezone_object->setApiKey(API_KEY);

// Perform query.
$timezone_data = $timezone_object->queryTimeZone();

echo '<pre>';
print_r($timezone_data);
echo '</pre>';
>>>>>>> origin/master
2 changes: 1 addition & 1 deletion phpdoc.dist.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
<title>GoogleTimeZone - A PHP wrapper for the Google Maps TimeZone API.</title>
<title>GoogleTimeZone - A PHP wrapper for the Google Maps Time Zone API.</title>
<parser>
<target>docs</target>
</parser>
Expand Down
Loading

0 comments on commit daa60b6

Please sign in to comment.