PHP code example of konnco / laravel-rajaongkir

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

    

konnco / laravel-rajaongkir example snippets


'providers' => [
	....
	
	konnco\laravel-rajaongkir\RajaOngkirServiceProvider::class,
]

'aliases' => [
	....
	
	'RajaOngkir' => konnco\laravel-rajaongkir\RajaOngkirFacade::class,
]

'end_point_api' => 'isi_base_url_api_akun_anda_disini',
'api_key' => 'isi_api_key_anda_disini',

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

$data = RajaOngkir::Provinsi()->count();

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

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

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

$data = RajaOngkir::Kota()->count();

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

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

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

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

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

$data = 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();

php artisan vendor:publish