From 81bb478980ef4d75fcdedcebae286907965f0457 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 13 Dec 2012 22:45:12 -0500 Subject: [PATCH] Added some usage examples --- README.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 050a1ab..378ff65 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,55 @@ php-googleplaces ================ -PHP Wrapper for the Google Places API \ No newline at end of file +PHP Wrapper for the Google Places API. + +Origins +------- + +Simply put, when I Googled "php google places" I was presented with [https://github.com/anthony-mills/Google-Places---PHP-]. I attempted to use it, and it was fine as I was able to make it work, but there seemed to be a huge assumption that you already know the Google Places API. + +I did not fit into this assumption and set out to built my own wrapper with a heavy focus on sanity checking inputs, utilizing the magical parts of PHP (reads you interact directly with the objecta as you would the API) and avoiding setter methods as they were put here by the devil. + +I didn't fork because I was going to change too much and I highly doubt my pull requests would have been accepted. + +Usage Examples +-------------- + +### Getting started + +```php + +``` + +### Search nearby, ranked by prominence + +```php +location = array(-33.86820, 151.1945860); +$google_places->radius = 800; + +$places = $google_places->searchNearby(); + +?> +``` + +### Search nearby, ranked by distance + +```php +location = array(-33.86820, 151.1945860); +$google_places->rankby = 'distance'; +$google_places->types = 'restaurant'; // Requires keyword, name or types + +$places = $google_places->searchNearby(); + +?> +```