1. Go to this page and download the library: Download juhara/rajaongkir 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/ */
juhara / rajaongkir example snippets
$rajaongkir = new Juhara\Rajaongkir('YOUR_API_KEY', Rajaongkir::ACCOUNT_STARTER);
$rajaongkir = new Juhara\Rajaongkir('YOUR_API_KEY');
use Juhara\Rajaongkir;
$rajaongkir = new Rajaongkir('YOUR_API_KEY', Rajaongkir::ACCOUNT_BASIC);
use Juhara\Rajaongkir;
$rajaongkir = new Rajaongkir('YOUR_API_KEY', Rajaongkir::ACCOUNT_PRO);
$provinces = $rajaongkir->getProvinces();
// province ID = 1
$province = $rajaongkir->getProvince(1);
$cities = $rajaongkir->getCities();
// province id = 1
$cities = $rajaongkir->getCities(1);
// city id = 1
$city = $rajaongkir->getCity(1);
// city id = 39
$subdistricts = $rajaongkir->getSubdistricts(39);
// subdistrict id = 537
$subdistrict = $rajaongkir->getSubdistrict(537);
// not available for starter
$internationalOrigins = $rajaongkir->getInternationalOrigins();
// not available for starter
// province id = 6
$internationalOrigins = $rajaongkir->getInternationalOrigins(6);
// not available for starter
// city id = 152
// province id = 6
$internationalOrigin = $rajaongkir->getInternationalOrigin(152, 6);
// not available for starter
$internationalDestinations = $rajaongkir->getInternationalDestinations();
// not available for starter
// country id = 108
$internationalDestination = $rajaongkir->getInternationalDestination(108);
// origin city id = 501
// destination subdistrict id = 574
// weight 1000 gram
// courier = 'jne'
$cost = $rajaongkir->getCost(['city' => 501], ['subdistrict' => 574], 1000, 'jne');