PHPackages                             therour/rajaongkir-laravel - 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. therour/rajaongkir-laravel

ActivePackage[API Development](/categories/api)

therour/rajaongkir-laravel
==========================

RajaOngkir API for Laravel 5

2781PHP

Since Apr 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/therour/rajaongkir-laravel)[ Packagist](https://packagist.org/packages/therour/rajaongkir-laravel)[ RSS](/packages/therour-rajaongkir-laravel/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (1)Used By (0)

rajaongkir-laravel
==================

[](#rajaongkir-laravel)

Raja Ongkir API Laravel 5

This current version of rajaongkir api for laravel is currently for ***starter*** account only

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

[](#installation)

via Composer

```
composer require therour/rajaongkir-laravel

```

Add Service provider to `config/app.php` of your laravel project

```
'providers' => [
      ....

      Therour\RajaOngkir\RajaOngkirServiceProvider::class,
]
```

Settings
--------

[](#settings)

add your credential in `config/services.php` of your laravel project

```
....

'rajaongkir' => [
    'base_uri' => env('RAJAONGKIR_BASE_URI', 'https://api.rajaongkir.com'),
    'type' => env('RAJAONGKIR_type', 'starter'),
    'key' => env('RAJAONGKIR_API_KEY', null),
    'origin' => env('RAJAONGKIR_ORIGIN'), // if you have fixed origin city id,
]
```

### Cache

[](#cache)

This package also provides caching the provinces and cities available in RajaOngkir API, so your application does not need to request to RajaOngkir Endpoint API if you have cache to it, we used `cache('rajaongkir.provinces')` and `cache('rajaongkir.cities')` key to cache these.

to enable caching of provinces and cities add this code to your `app\Providers\AppServiceProvider.php`

```
use Therour\RajaOngkir\Facades\RajaOngkir;

class AppServiceProvider extends ServiceProvider
{

    public function boot()
    {
    	....

    	RajaOngkir::shouldCache($expire = 60); // cache expires in 60 minutes
    }

    ....
}
```

Usage
-----

[](#usage)

### With Facade

[](#with-facade)

you need to add RajaOngkir Facade to aliases in your `config/app.php`

```
'aliases' => [
      ....

      'RajaOngkir' => Therour\RajaOngkir\Facades\RajaOngkir::class,
]
```

#### Get Province and City by RajaOngkir

[](#get-province-and-city-by-rajaongkir)

```
use RajaOngkir;

$provinces = RajaOngkir::getProvinces; // return array of Therour\RajaOngkir\Province Objects

$cities = RajaOngkir::getCities; // return array of Therour\RajaOngkir\Province Objects

$myProvince = RajaOngkir::getProvince($id); // return a Therour\RajaOngkir\Province

$citiesAroundMe = $myProvince->cities; // return array of Therour\RajaOngkir\City
```

#### Calculate shipment cost

[](#calculate-shipment-cost)

Note:

VariableTypeExample`$originID`*integer*`501``$destinationID`*integer*`39``$weight`*integer* **(gram)**`3000``$courier`*string* **(jne,tiki,pos)**`'tiki'`Code:

```
use RajaOngkir;

// get calculation with default origin by your application service config
$cost = RajaOngkir::calculate($destinationID, $weight, $courier);

// get calculation with defining another origin
$cost = RajaOngkir::from($originID)->calculate($destinationID, $weight, $courier);

// another way to calculate with JNE courier
$cost = RajaOngkir::from($originID)->to($destinationID)->withJne()->send($weight);

// another way to calculate with TIKI courier
$cost = RajaOngkir::from($originID)->to($destinationID)->withTiki()->send($weight);

// another way to calculate with POS courier
$cost = RajaOngkir::from($originID)->to($destinationID)->withPos()->send($weight);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/86f52784d71b1c9dd763012ac0c0f5d14e5c45aa2fa79676d3261a24ac813da2?d=identicon)[therour](/maintainers/therour)

---

Top Contributors

[![therour](https://avatars.githubusercontent.com/u/16388470?v=4)](https://github.com/therour "therour (8 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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