shiishiji / google-places-sdk
There is no license information available for the latest version (1.1.2) of this package.
1.1.2
2022-08-17 19:45 UTC
Requires
- php: >=8.1
- monolog/monolog: 1.0.*
- symfony/http-client: ^6.1
- symfony/property-access: ^6.1
- symfony/serializer: ^6.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.9
- phpspec/phpspec: ^7.2
- symfony/var-dumper: ^6.1
README
Official google API documentation -> here
Installation
composer require shiishiji/google-places-sdk
Usage
- Get your access token and create Configuration object
use Shiishiji\GooglePlacesSDK\Config\Configuration; $configuration = new Configuration( authToken: 'this-is-place-for-your-token', );
- Instantiate facade class
use Shiishiji\GooglePlacesSDK\GooglePlacesFacade; use Shiishiji\GooglePlacesSDK\Client\JsonClientFactory; use Shiishiji\GooglePlacesSDK\Transformer\TransformerContext; use Shiishiji\GooglePlacesSDK\Transformer\NearbySearchFiltersTransformer; $facade = new GooglePlacesFacade( configuration: $configuration, )
- Examples
Execute Nearby Search request
use Shiishiji\GooglePlacesSDK\DTO\Input\NearbySearchFilters; use Shiishiji\GooglePlacesSDK\DTO\Location; $facade->getNearbyPlaces(new NearbySearchFilters( location: new Location(lat: '40', lng: '-110'), language: 'en', radius: 4000, ));
Execute Find Place From Text request
use Shiishiji\GooglePlacesSDK\DTO\Input\FindPlaceByTextFilters; use Shiishiji\GooglePlacesSDK\DTO\Input\Partials\Fields; $facade->getPlacesFromText(new FindPlaceByTextFilters( input: 'Museum of Contemporary Art Australia', inputType: 'textquery', fields: new Fields([Fields::FORMATTED_ADDRESS, Fields::PLACE_ID]), locationBias: 'ipbias', language: 'en', ));
Development
Before any of command below, docker image must be build
docker build -t google-places-sdk .
Install dependencies
docker run --rm -t -v $PWD:/app google-places-sdk composer install
Run tests
docker run --rm -t -v $PWD:/app google-places-sdk vendor/bin/phpspec run
Run PHP CS fixer
docker run --rm -t -v $PWD:/app google-places-sdk vendor/bin/php-cs-fixer fix