PHP code example of omsoft / postalcodemex-client

1. Go to this page and download the library: Download omsoft/postalcodemex-client 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/ */

    

omsoft / postalcodemex-client example snippets


use PostalCodeMexClient;

$colonias = PostalCodeMexClient::getNeighborhoods('12345');

if ($colonias->successful()) {
    $data = $colonias->json();
    // Maneja los datos de las colonias
} else {
    // Manejar error
}

getNeighborhoods(string $cp): PromiseInterface|Response
getStates(): PromiseInterface|Response
getTownByState(string $state): PromiseInterface|Response
getPostalCodesByTown(string $town): PromiseInterface|Response
getSettlements(): PromiseInterface|Response
getZones(): PromiseInterface|Response
bash
php artisan vendor:publish --tag=postalcodemex-config