akara/bagisto-rajaongkir 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

akara/bagisto-rajaongkir

Composer 安装命令:

composer require akara/bagisto-rajaongkir

包简介

High-reliability RajaOngkir shipping integration for Bagisto.

README 文档

README

High-reliability RajaOngkir API client and Bagisto shipping method package with full caching, dedupe, retry, cooldown protection, and deterministic rate optimization.

Overview

This package provides a fully production-grade RajaOngkir shipping integration for Bagisto. It includes:

  • Optimized RajaOngkir API client
  • Automatic cost caching (15m)
  • Destination caching (24h)
  • Lifecycle request dedupe - Retry + exponential backoff
  • Upstream cooldown protection
  • Normalized rate sorting (cheapest-first or ETA-first logic)
  • Bagisto-compatible shipping method service
  • Comprehensive logging with trace IDs

Features

1. Reliable Client

  • HTTP retry with incremental delay
  • 429/5xx cooldown enforcement
  • Fail-soft mode during cooldown
  • Structured logging (request, success, failure, exception)
  • Normalized request validation
  • Deterministic caching
  • Lifecycle dedupe to prevent duplicate processing

2. Shipping Rate Optimizer

  • Remove duplicate courier services by ETA bracket
  • Select lowest price per ETA per courier
  • Global sort (cheapest → ETA → deterministic tie-breaker)

3. Bagisto Integration

  • Drop-in service provider
  • Configurable API key
  • Shipping method class with pre-validation + exception-safe rate fetching
  • Production-safe calculate() wrapper
  • Full logging

Requirements

  • PHP 8.1+
  • Laravel 10+
  • Bagisto 2.x

Installation

composer require akara/bagisto-rajaongkir

Usage

After installing and configuring the RajaOngkir shipping package, follow these steps to enable and use it in Bagisto.

1. Enable Shipping Method in Admin Panel

  1. Log in to your Bagisto admin panel.
  2. Navigate to Configure → Sales → Shipping Methods.
  3. Locate RajaOngkir Shipping in the list.
  4. Set Status to Active.
  5. Configure additional options:
    • Origin City – the shipping origin for your store.
    • Enabled Couriers – select couriers supported by RajaOngkir.
    • Rate Sorting – choose Cheapest First or Fastest ETA First.
  6. Save changes.

2. Checkout Usage

Once enabled, RajaOngkir shipping rates will automatically appear on the checkout page for eligible destinations. Calculation is automatic and based on:

  • Cart Contents: weights and quantities of items in the cart.
  • Origin & Destination: origin city from admin config, destination from customer shipping address.
  • RajaOngkir API: fetches live rates.
  • Optimization: deduplication, caching, and global rate sorting.

Rates are:

  • Cached for 15 minutes (costs) and 24 hours (destination info).
  • Deduplicated by courier and ETA.
  • Sorted according to the selected rate optimization logic.

3. Logs & Troubleshooting

All API requests are logged with structured trace IDs:

Additionnal Information

Rate Optimization Logic

Step 1: Normalize ETA window

Step 2: Deduplicate per Courier

Step 3: Global Sort

  • Cheapest price
  • Fastest ETA
  • Deterministic fallback by courier code

Logging

All requests include structured logs.

Caching & Dedupe

  • Destination cache: 24h
  • Cost cache: 15m
  • API cooldown: 60s

License

MIT License

Copyright (c) 2025 N.Pratama

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

akara/bagisto-rajaongkir 适用场景与选型建议

akara/bagisto-rajaongkir 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 akara/bagisto-rajaongkir 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 akara/bagisto-rajaongkir 我们能提供哪些服务?
定制开发 / 二次开发

基于 akara/bagisto-rajaongkir 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-18