PHP code example of rizalafani / rajaongkir

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

    

rizalafani / rajaongkir example snippets


protected $apiKey = 'isi_api_key_anda_disini';



$data = RajaOngkir\RajaOngkir::Provinsi()->all();

$data = RajaOngkir\RajaOngkir::Provinsi()->find($id);

$data = RajaOngkir\RajaOngkir::Provinsi()->search('province', $name = "ja")->get();

$data = RajaOngkir\RajaOngkir::Kota()->all();

$data = RajaOngkir\RajaOngkir::Kota()->find($id);

$data = RajaOngkir\RajaOngkir::Kota()->search('city_name', $name = "banyu")->get();

$data = RajaOngkir\RajaOngkir::Kota()->byProvinsi($provinsi_id)->get();

$data = RajaOngkir\RajaOngkir::Kota()->byProvinsi($provinsi_id)->search('city_name', $name)->get();

$data = RajaOngkir\RajaOngkir::Cost([
	'origin' 		=> 501, // id kota asal
	'destination' 	=> 114, // id kota tujuan
	'weight' 		=> 1700, // berat satuan gram
	'courier' 		=> 'jne', // kode kurir pengantar ( jne / tiki / pos )
])->get();