rahmap / rajaongkir-ci4
Library Rajaongkir for Codeigniter 4
1.3
2021-01-29 21:14 UTC
Requires
- php: >=7.2
Requires (Dev)
- ext-curl: *
This package is auto-updated.
Last update: 2025-04-17 06:43:58 UTC
README
CodeIgniter library for consuming RajaOngkir API. This library is an update from andisis which is only for Codeigniter 3.x and not updated. This library can be used for all types of accounts (starter, basic and pro).
Installation
composer require rahmap/rajaongkir-ci4
Check :
app/Controllers/Home.php
app/Libraries/Rajaongkir.php
app/Libraries/RajaOngkir/Endpoints.php
app/Libraries/Rajaongkir/Restclient.php
Configuration
Open "PROJECT_ROOT => .env", enter the API key and change the account type.
Usage
First, load the RajaOngkir library on Controllers
.
use \App\Libraries\Rajaongkir;
Make a request
# Instance Object $RO = new RajaOngkir(); # Get all province $provinces = $RO->province(); # Get all cities $cities = $RO->city(); # Get districts based on cities $subdistrict = $RO->subdistrict(151); // city_id = 151 # Get shipping costs $cost = $RO->cost(501, 114, 1000, "jne");
Response
The resulting response is a JSON string reply from RajaOngkir.