PHP code example of teamzac / points-of-interest

1. Go to this page and download the library: Download teamzac/points-of-interest library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

teamzac / points-of-interest example snippets

config/app.php
 php
    // providers
    \TeamZac\POI\PointsOfInterestServiceProvider::class,
    
    // aliases
    'POI' => \TeamZac\POI\Facades\POI::class,
 bash
php artisan vendor:publish --provider="TeamZac\POI\PointsOfInterestServiceProvider"
 php
POI::driver('google');
 php
$query = POI::search(/** optional search term goes here */);

$collection = $query->get();
 php
// Google google')->search()->near(Address::make([
    'latLng' => LatLng::make(32, -97),
])->radius(500); // meters

// Yelp  'Texas',
    'postalCode' => 76102,
    'country' => 'US',
]);
 php
Address::make([
    'street' => '123 Main Street',
    // etc
]);
 php
LatLng::make(32, -97);
 php
$place = POI::driver('google')->retrieve('provider-id');

$place->getProvider();      // 'google'
$place->getId();            // 'provider-id'
$place->getName();          // business name
$place->getAddress();       // TeamZac\POI\Support\Address
$place->getPhone();         // phone number
$place->getCategories();    // array of category strings
$place->getRaw();           // array containing the raw results from the provider
 php
POI::extend('new-provider', function($app) {
    // create and return your driver here
});
phone($number = null)