PHP code example of wordpressvn / vietnam-address

1. Go to this page and download the library: Download wordpressvn/vietnam-address 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/ */

    

wordpressvn / vietnam-address example snippets




use WPVNTeam\VietnamAddressAPI\Address;

echo "<pre>";

print_r(Address::getProvinces());

Address::setSchema(['name', 'type']);

print_r(Address::getProvinces(['01', 87, 12]));

print_r(Address::getProvince('01'));

print_r(Address::getDistrictsByProvinceId('01'));

print_r(Address::getDistrict('009'));

print_r(Address::getWardsByDistrictId('009'));

print_r(Address::getWard('009', '00346'));

print_r(Address::getDistrictsByProvinceName('Tây Ninh'));

print_r(Address::getDistrictsByProvinceName('tay-ninh', 'slug'));

print_r(Address::getWardsByDistrictName('Tân Biên, Tây Ninh'));

print_r(Address::getWardsByDistrictName('Huyện Tân Biên, Tỉnh Tây Ninh', 'name_with_type'));