PHP code example of yusufthedragon / jne-php
1. Go to this page and download the library: Download yusufthedragon/jne-php 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/ */
yusufthedragon / jne-php example snippets
\YusufTheDragon\JNE\JNE::setUsername('username')->setApiKey('apiKey');
\YusufTheDragon\JNE\JNE::setProductionMode(true);
// or chain it
\YusufTheDragon\JNE\JNE::setUsername('username')->setApiKey('apiKey')->setProductionMode(true);
\YusufTheDragon\JNE\Fare::getFares(array $parameters);
$params = [
'from' => 'CGK10000',
'thru' => 'BDO10000',
'weight' => 1
];
$getFares = \YusufTheDragon\JNE\Fare::getFares($params);
var_dump($getFares);
\YusufTheDragon\JNE\JOB::create(array $parameters);
$params = [
'SHIPPER_NAME' => 'John Doe',
'SHIPPER_ADDR1' => 'Jl. Custom Address No. 10',
'SHIPPER_CITY' => 'JAMBI',
'SHIPPER_ZIP' => '36136',
'SHIPPER_REGION' => 'JAMBI',
'SHIPPER_COUNTRY' => 'INDONESIA',
'SHIPPER_CONTACT' => 'John Doe',
'SHIPPER_PHONE' => '+6287793443322',
'RECEIVER_NAME' => 'Jane Doe',
'RECEIVER_ADDR1' => 'Jl. Custom Address No. 20',
'RECEIVER_CITY' => 'TANGERANG SELATAN',
'RECEIVER_ZIP' => '31264',
'RECEIVER_REGION' => 'BANTEN',
'RECEIVER_COUNTRY' => 'INDONESIA',
'RECEIVER_CONTACT' => 'Jane Doe',
'RECEIVER_PHONE' => '+6287793443322',
'ORIGIN_DESC' => 'Custom Description',
'ORIGIN_CODE' => 'CGK10100',
'DESTINATION_DESC' => 'Dummy Description',
'DESTINATION_CODE' => 'CGK10101',
'SERVICE_CODE' => 'REG',
'WEIGHT' => 1,
'QTY' => 1,
'GOODS_DESC' => 'Goods Description',
'DELIVERY_PRICE' => 9000,
'BOOK_CODE' => 'NT-52744198231'
];
$createJOB = \YusufTheDragon\JNE\JOB::create($params);
var_dump($createJOB);
\YusufTheDragon\JNE\AirWayBill::register(array $parameters);
$params = [
'ORDER_ID' => '',
'AWB_NUMBER' => ''
];
$registerAWB = \YusufTheDragon\JNE\AirWayBill::register($params);
var_dump($registerAWB);
\YusufTheDragon\JNE\Tracking::trace(string $awbNumber);
$tracePackage = \YusufTheDragon\JNE\Tracking::trace('0114541900204500');
var_dump($tracePackage);
bash
composer