antonamosov / laravel-getting-locations
A getting of JSON-encoded locations data stored in predefined format.
dev-master
2018-12-22 14:40 UTC
Requires
- guzzlehttp/guzzle: ~6.0
- illuminate/support: ~5
Requires (Dev)
- phpunit/phpunit: ~7.0
This package is not auto-updated.
Last update: 2024-05-20 05:30:15 UTC
README
An laravel package for a getting of locations using custom service.
Installation
Require this package with composer using the following command:
$ composer require "antonamosov/laravel-getting-locations @dev"
After updating composer, add the service provider to the providers array in config/app.php
Antonamosov\LaravelGettingLocations\LaravelGettingLocationsServiceProvider::class,
And add the alias to aliases array in config/app.php
'GettingLocations' => Antonamosov\LaravelGettingLocations\Facades\LaravelGettingLocations::class,
Publish the config file to change implementations, select service and API key:
$ php artisan vendor:publish --provider="Antonamosov\LaravelGettingLocations\LaravelGettingLocationsServiceProvider" --tag="config"
Usage
use LaravelGettingLocations; $response = LaravelGettingLocations::getLocations([ 'name' => 'Moscow City', 'address' => 'Lenina', 'postalCode' => '185000', 'country' => 'Russia', ]); if ($response->success) { foreach ($response->data->locations as $location) { echo $location->name . "\n"; echo $location->coordinates->lat . "\n"; echo $location->coordinates->long . "\n\n"; } }
Testing
./vendor/bin/phpunit vendor/antonamosov/laravel-getting-locations/tests/LaravelGettingLocationsTest.php