gufy/rajaongkir

Alternative Rajaongkir API using Guzzle

v1.0.0 2016-09-06 10:30 UTC

This package is auto-updated.

Last update: 2024-12-13 19:02:40 UTC


README

Another alternative of rajaongkir PHP API. It is using GuzzleHttp as its underlying CURL request

Installation

Run this on your composer composer require gufy/rajaongkir

Usage

<?php
use Gufy\Rajaongkir\Rajaongkir;
use Gufy\Rajaongkir\Province;
use Gufy\Rajaongkir\City;
use Gufy\Rajaongkir\Cost;
use Gufy\Rajaongkir\Waybill;
// initialize api. first argument will be your api key, and the second one is your package
Rajaongkir::init('your-api-key', 'starter');

// get all provinces
$provinces = Province::all();

// get cities
$cities = City::all();

// get cities based on province id
$cities = City::all($province_id);

// get cost
$cost = Cost::get(['city'=>$origin_city_id], ['city'=>$destination_city], $weight, 'jne');

// get waybill
$cost = Waybill::find('jne', 'your-waybill');