PHP code example of becklyn / postal-code-proximity
1. Go to this page and download the library: Download becklyn/postal-code-proximity 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/ */
becklyn / postal-code-proximity example snippets
use Becklyn\PostalCodeProximity\QueryGenerator;
$queryGenerator = new QueryGenerator($tableName, $latitudeColumn = "lat", $longitudeColumn = "lng", $postalCodeColumn = "zip");
use Becklyn\PostalCodeProximity\Adapter\PdoAdapter;
$pdo = new \PDO("...", "user", "password");
$databaseAdapter = new PdoAdapter($pdo, $queryGenerator);
use Becklyn\PostalCodeProximity\Adapter\MysqliAdapter;
$mysqli = new \mysqli("localhost", "user", "password", "dbname");
$databaseAdapter = new MysqliAdapter($mysqli, $queryGenerator);
use Becklyn\PostalCodeProximity\PostalCodeLocator;
$postalCodeLocator = new PostalCodeLocator($databaseAdapter);
$postalCodeLocator->loadNearPostalCodes($postalCode, $radius, $limit = null);