agungtri222/laravel-rajaongkir 问题修复 & 功能扩展

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

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

agungtri222/laravel-rajaongkir

Composer 安装命令:

composer require agungtri222/laravel-rajaongkir

包简介

RajaOngkir larvel request wrapper

README 文档

README

Latest Version on Packagist Software License Contributor Covenant

Laravel RajaOngkir API package.

Requirements

Install

Require this package with composer using the following command:

composer require agungtri222/laravel-rajaongkir

Configuration

This package needs some configuration to utilizing RajaOngkir API Services. Add these lines to your .env, then update respective values based on your preferences.

RAJAONGKIR_ENDPOINT=
RAJAONGKIR_API_KEY=

Publish package configuration via command:

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

RajaOngkir Service Facade

This package offers features to manage RajaOngkir API Request along with helpful facade RajaOngkir.

City

Use it with syntax RajaOngkir::city().

This will return array of all cities data.

see example below.

    229 => array:6 [
      "city_id" => "230"
      "province_id" => "21"
      "province" => "Nanggroe Aceh Darussalam (NAD)"
      "type" => "Kota"
      "city_name" => "Langsa"
      "postal_code" => "24412"
    ]
    230 => array:6 [
      "city_id" => "231"
      "province_id" => "24"
      "province" => "Papua"
      "type" => "Kabupaten"
      "city_name" => "Lanny Jaya"
      "postal_code" => "99531"
    ]
    231 => array:6 [
      "city_id" => "232"
      "province_id" => "3"
      "province" => "Banten"
      "type" => "Kabupaten"
      "city_name" => "Lebak"
      "postal_code" => "42319"
    ]

if you want to search by specified city id and province id use it with RajaOngkir::city($cityId, $provinceId) with string parameter $cityId and $provinceId

and it would return array of response data. see example below.

array:3 [
  "query" => array:2 [
    "city" => "39"
    "province" => "5"
  ]
  "status" => array:2 [
    "code" => 200
    "description" => "OK"
  ]
  "results" => array:5 [
    0 => array:6 [
      "city_id" => "39"
      "province_id" => "5"
      "province" => "DI Yogyakarta"
      "type" => "Kabupaten"
      "city_name" => "Bantul"
      "postal_code" => "55715"
    ]
    1 => array:6 [
      "city_id" => "135"
      "province_id" => "5"
      "province" => "DI Yogyakarta"
      "type" => "Kabupaten"
      "city_name" => "Gunung Kidul"
      "postal_code" => "55812"
    ]
    2 => array:6 [
      "city_id" => "210"
      "province_id" => "5"
      "province" => "DI Yogyakarta"
      "type" => "Kabupaten"
      "city_name" => "Kulon Progo"
      "postal_code" => "55611"
    ]
    3 => array:6 [
      "city_id" => "419"
      "province_id" => "5"
      "province" => "DI Yogyakarta"
      "type" => "Kabupaten"
      "city_name" => "Sleman"
      "postal_code" => "55513"
    ]
    4 => array:6 [
      "city_id" => "501"
      "province_id" => "5"
      "province" => "DI Yogyakarta"
      "type" => "Kota"
      "city_name" => "Yogyakarta"
      "postal_code" => "55111"
    ]
  ]
]

Province

Use it with syntax RajaOngkir::province().

if you want to search by specified city id and province id use it with RajaOngkir::province($provinceId) with string parameter $provinceId

Currencies

Use it with syntax RajaOngkir::currency()

Cost

use it with syntax RajaOngkir::cost($origin, $destination, $courier, $weight) provide with string $origin, $destination, $courier and integer of total weight $weight

International Cost

use it with syntax RajaOngkir::internationalCost($origin, $destination, $courier, $weight) provide with string $origin, $destination, $courier and integer of total weight $weight

Waybill

With Waybill method you can track your delivery status based on receipt number. use it with syntax RajaOngkir::waybill($waybill, $courier) provide the string of your receipt number and courier.

International destination

The internationalDestination method is used to get a list/name of the international shipping destination country. use it with syntax RajaOngkir::internationalDestination($id) with string parameter $id

International origin

The internationalOrigin method is used to get a list/name of cities that support international shipping. use it with syntax RajaOngkir::internationalOrigin($id, $province) with string parameter $id and $province

Testing

The tests are written with phpunit.

Please provide a .env.testing file in root package directory with contents same as .env.example before running test command.

You can run the tests from the root of the project directory with the following command.

vendor/bin/phpunit

License

The Laravel RajaOngkir package is open source software licensed under the GNU LGPL license version 3

agungtri222/laravel-rajaongkir 适用场景与选型建议

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

它主要适用于以下技术方向: 「api」 「wrapper」 「laravel」 「rajaongkir」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-09