blissjaspis / laravel-rajaongkir-komerce
Laravel Rajaongkir From Komerce
Requires
- guzzlehttp/guzzle: ^7.9
- illuminate/console: ^10.0 | ^11.0 | ^12.0
- illuminate/support: ^10.0 | ^11.0 | ^12.0
Requires (Dev)
- laravel/pint: ^1.24
- orchestra/testbench: ^10.4
- phpunit/phpunit: ^12.2
README
Note This package supports Laravel versions 10, 11, and 12.
This package provides a simple and easy-to-use Laravel wrapper for the RajaOngkir Komerce API.
Installation
You can install the package via composer:
composer require bliss-jaspis/laravel-rajaongkir-komerce
You must publish the configuration file with:
php artisan vendor:publish --provider="BlissJaspis\RajaOngkir\Providers\RajaOngkirServiceProvider" --tag="config"
This will create a config/rajaongkir-komerce.php
file in your config
directory.
Add the following to your .env
file:
RAJAONGKIR_API_KEY=your-api-key RAJAONGKIR_BASE_URL=https://rajaongkir.komerce.id/api/v1
Usage
You can use this package by injecting the BlissJaspis\RajaOngkir\RajaOngkir
class into your controller or service.
use BlissJaspis\RajaOngkir\Facades\RajaOngkir; class YourController { // ... public function getProvinces() { $provinces = RajaOngkir::getProvinces(); return $provinces; } }
Available Methods
getProvinces()
getCity(string $provinceId)
getDistrict(string $cityId)
getSubDistrict(string $districtId)
getWaybill(string $waybill, string $courier)
getCostDomestic(string $origin, string $destination, int $weight, string $courier, string $filter = 'lowest')
getCostInternational(string $origin, string $destination, int $weight, string $courier, string $filter = 'lowest')
searchDomestic(string $search, int $limit = 10, int $offset = 0)
searchInternational(string $search, int $limit = 10, int $offset = 0)
getListCourier()
API Reference
For more detailed information about the API endpoints, parameters, and response structures, please refer to the official RajaOngkir Komerce API Documentation.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.