PHPackages                             blissjaspis/laravel-rajaongkir-komerce - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. blissjaspis/laravel-rajaongkir-komerce

ActiveLibrary[API Development](/categories/api)

blissjaspis/laravel-rajaongkir-komerce
======================================

Laravel Rajaongkir From Komerce

2.0.0(1mo ago)126MITPHPPHP ^8.2

Since Jul 18Pushed 1mo agoCompare

[ Source](https://github.com/blissjaspis/laravel-rajaongkir-komerce)[ Packagist](https://packagist.org/packages/blissjaspis/laravel-rajaongkir-komerce)[ RSS](/packages/blissjaspis-laravel-rajaongkir-komerce/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (12)Versions (6)Used By (0)

Laravel RajaOngkir From Komerce
===============================

[](#laravel-rajaongkir-from-komerce)

> **Note**This package supports Laravel versions 11, 12, and 13.

This package provides a simple and easy-to-use Laravel wrapper for the RajaOngkir Komerce API. It supports two methods of address lookup: hierarchical step-by-step selection and direct search with autocomplete functionality.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require blissjaspis/laravel-rajaongkir-komerce
```

You must publish the configuration file with:

```
php artisan vendor:publish --provider="BlissJaspis\RajaOngkir\Providers\RajaOngkirServiceProvider" --tag="config"
```

Add the following to your `.env` file:

```
RAJAONGKIR_API_KEY=your-api-key
RAJAONGKIR_BASE_URL=https://rajaongkir.komerce.id/api/v1
```

Usage
-----

[](#usage)

There are two ways to use Rajaongkir-Komerce:

1. **Step-by-step method**. This was the old method before Komerce acquired Rajaongkir and changed the API.
2. **Direct Search**. This is the latest method used by Komerce after they acquired Rajaongkir.

For existing users whose data is still using the old method, you can continue using method 1.

This package supports 2 ways to access RajaOngkir data:

1. Step-by-step location lookup (`province -> city -> district -> subdistrict`)
2. Direct search and shipping cost lookup (search by keyword, then calculate cost)

You can call the API through the facade in controllers/services:

```
use BlissJaspis\RajaOngkir\Facades\RajaOngkir;
```

### Choosing Between Methods

[](#choosing-between-methods)

**Use Method 1 (Step-by-step)** if:

- You have existing user data stored in the hierarchical format
- You prefer structured location selection with multiple dropdowns
- You're migrating from the old Rajaongkir API structure

**Use Method 2 (Direct Search)** if:

- You're building a new application
- You want a better user experience with search/autocomplete
- You want to simplify your frontend code and reduce API calls
- You want to provide international shipping options

Method 2 is recommended for new implementations as it provides a more modern and user-friendly approach.

### Method 1: Step-by-Step Location Lookup

[](#method-1-step-by-step-location-lookup)

Use this method when users select addresses hierarchically.

#### 1. Finding Provinces

[](#1-finding-provinces)

```
$provinces = RajaOngkir::getProvinces();

{
  "meta": {
    "message": "Success Get Provinces",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "id": 11,
      "name": "DKI Jakarta"
    },
    {
      "id": 6,
      "name": "Jawa Barat"
    }
    // ... more provinces
  ]
}
```

#### 2. Finding Cities

[](#2-finding-cities)

```
$provinceId = 11;
$cities = RajaOngkir::getCity($provinceId);

{
  "meta": {
    "message": "Success Get Cities",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "id": 1,
      "name": "Jakarta Pusat"
    },
    {
      "id": 2,
      "name": "Jakarta Selatan"
    }
    // ... more cities
  ]
}
```

#### 3. Finding Districts

[](#3-finding-districts)

```
$cityId = 1;
$districts = RajaOngkir::getDistrict($cityId);

{
  "meta": {
    "message": "Success Get Districts",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "id": 1,
      "name": "Kemayoran"
    }
    // ... more districts
  ]
}
```

#### 4. Finding Subdistricts

[](#4-finding-subdistricts)

```
$districtId = 1;
$subdistricts = RajaOngkir::getSubDistrict($districtId);

{
  "meta": {
    "message": "Success Get Subdistricts",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "id": 1,
      "name": "Sumur Batu"
    }
    // ... more subdistricts
  ]
}
```

### Method 2: Direct Search and Cost Lookup

[](#method-2-direct-search-and-cost-lookup)

Use this method when users type destination keywords directly, then you calculate shipping.

#### 1. Searching Domestic Destinations

[](#1-searching-domestic-destinations)

```
$search = 'sinduharjo';
$limit = 10; // optional
$offset = 0; // optional
$destinations = RajaOngkir::searchDomestic($search, $limit, $offset);

{
  "meta": {
    "message": "Success Get Domestic Destinations",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "id": 31555,
      "label": "SINDUHARJO, NGAGLIK, SLEMAN, DI YOGYAKARTA, 55581",
      "subdistrict_name": "SINDUHARJO",
      "district_name": "NGAGLIK",
      "city_name": "SLEMAN",
      "province_name": "DI YOGYAKARTA",
      "zip_code": "55581"
    }
  ]
}
```

#### 2. Searching International Destinations

[](#2-searching-international-destinations)

```
$search = 'Malaysia';
$limit = 10; // optional
$offset = 0; // optional
$destinations = RajaOngkir::searchInternational($search, $limit, $offset);

{
  "meta": {
    "message": "Success Get International Destinations",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "id": 108,
      "name": "Malaysia"
    }
    // ... more destinations
  ]
}
```

#### 3. Calculating Domestic Shipping Cost

[](#3-calculating-domestic-shipping-cost)

```
$origin = 1;
$destination = 108;
$weight = 1000;
$courier = 'jne';
$filter = 'lowest';

$cost = RajaOngkir::getCostDomestic($origin, $destination, $weight, $courier, $filter);

{
  "meta": {
    "message": "Success Calculate Domestic Shipping cost",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "name": "Nusantara Card Semesta",
      "code": "ncs",
      "service": "DARAT",
      "description": "Regular Darat",
      "cost": 8000,
      "etd": "6-7 day"
    },
    {
      "name": "Citra Van Titipan Kilat (TIKI)",
      "code": "tiki",
      "service": "ECO",
      "description": "Economy Service",
      "cost": 15000,
      "etd": "5 day"
    }
  ]
}
```

#### 4. Calculating International Shipping Cost

[](#4-calculating-international-shipping-cost)

```
$origin = 1;
$destination = 108;
$weight = 1000;
$courier = 'jne';
$filter = 'lowest';

$cost = RajaOngkir::getCostInternational($origin, $destination, $weight, $courier, $filter);

{
  "meta": {
    "message": "Success Calculate International Shipping Cost",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "name": "Rayspeed Indonesia",
      "code": "ray",
      "service": "Regular Service",
      "description": "Retail",
      "currency": "IDR",
      "cost": 55000,
      "etd": ""
    },
    {
      "name": "Lion Parcel",
      "code": "lion",
      "service": "INTERPACK",
      "description": "Active",
      "currency": "IDR",
      "cost": 65000,
      "etd": "2-3 day"
    }
  ]
}
```

#### 5. Tracking Waybill

[](#5-tracking-waybill)

```
$waybill = 'MT685U91';
$courier = 'jne';

$waybill = RajaOngkir::getWaybill($waybill, $courier);

{
  "meta": {
    "message": "Success Get Waybill",
    "code": 200,
    "status": "success"
  },
  "data": {
    "delivered": true,
    "summary": {
      "courier_code": "wahana",
      "courier_name": "Wahana Prestasi Logistik",
      "waybill_number": "MT685U91",
      "service_code": "",
      "waybill_date": "2024-10-08",
      "shipper_name": "TOKO ALAT LUKIS (08112XXXXXX)",
      "receiver_name": "FIKRI EL SARA (085668XXXXXX)",
      "origin": "",
      "destination": "di Kota Sukabumi",
      "status": "DELIVERED"
    },
    "details": {
      "waybill_number": "MT685U91",
      "waybill_date": "2024-10-08",
      "waybill_time": "11:14:29",
      "weight": "",
      "origin": "",
      "destination": "di Kota Sukabumi",
      "shipper_name": "TOKO ALAT LUKIS (08112XXXXXX)",
      "shipper_address1": "",
      "shipper_address2": "",
      "shipper_address3": "",
    }
    "delivery_status": {
      "status": "DELIVERED",
      "pod_receiver": "FIKRI EL SARA (085668XXXXXX)",
      "pod_date": "2024-10-11",
      "pod_time": "09:26:13"
    },
    "manifest": [
      // ... more manifest
    ]
  }
}
```

### Other Useful Methods

[](#other-useful-methods)

- `getListCourier()` returns supported courier codes and names.

```
$couriers = RajaOngkir::getListCourier();

{
  "meta": {
    "message": "Success Get List Courier",
    "code": 200,
    "status": "success"
  },
  "data": [
    {
      "code": "jne",
      "name": "JNE"
    },
    {
      "code": "sicepat",
      "name": "SICEPAT"
    }
  ]
}
```

API Reference
-------------

[](#api-reference)

For comprehensive API documentation including:

- Complete method signatures with parameter types
- Detailed response structures
- Error handling examples
- Testing examples
- Best practices
- Migration guides
- Troubleshooting

Please see [API-REFERENCE.md](API-REFERENCE.md) for detailed technical documentation optimized for developers and AI assistants.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Bliss Jaspis](https://github.com/blissjaspis)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance91

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~63 days

Total

5

Last Release

45d ago

Major Versions

1.2.0 → 2.0.02026-03-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c5c90080275353d1e65fc2655c85684598235849d2d4f98bef82f597cec5c6e?d=identicon)[jaspis](/maintainers/jaspis)

---

Top Contributors

[![blissjaspis](https://avatars.githubusercontent.com/u/19877298?v=4)](https://github.com/blissjaspis "blissjaspis (24 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/blissjaspis-laravel-rajaongkir-komerce/health.svg)

```
[![Health](https://phpackages.com/badges/blissjaspis-laravel-rajaongkir-komerce/health.svg)](https://phpackages.com/packages/blissjaspis-laravel-rajaongkir-komerce)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

765.7M125](/packages/saloonphp-laravel-plugin)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[grantholle/powerschool-api

A Laravel package to make interacting with PowerSchool less painful.

1715.6k1](/packages/grantholle-powerschool-api)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
