perigiweb/biteship

Biteship PHP 客户端

1.0.3 2023-11-05 10:36 UTC

This package is auto-updated.

Last update: 2024-09-13 07:34:59 UTC


README

此库是非官方的PHP客户端,用于访问 Biteship API

composer require perigiweb/biteship

如何使用

use Perigi\Biteship\Client;

$biteshipApiKey = '';
$client = new Client($biteshipApiKey);

支持的方法

获取可用快递公司

$availableCouriers = $client->getCouriers();

搜索区域

// single search https://biteship.com/id/docs/api/maps/retrieve_area_single
$areas = $client->searchArea($districtName);

// double search https://biteship.com/id/docs/api/maps/retrieve_area_double
$areas = $client->searchArea($districtName, 'double');

// areaId from double search result
$areas = $client->searchAreaById($areaId);

获取运费

$origin = 'IDN...'; // area_id
$destination = 'IDN....'; // area_id
$couriers = 'jne,jnt,sicepat,anteraja';
$items = [$item];

// origin and destination can be an array of postal code
$origin = [
  'origin_postal_code' => 11122
];
$destination = [
  'destination_postal_code' => 53461
];

// or combination of latitude and longitude
$origin = [
  'origin_latitude' => 5.8474647464,
  'origin_longitude' => 7.57575757
];
$destination = [
  'destination_latitude' => 3.8474647464,
  'destination_longitude' => 5.57575757
];

$rates = $client->getRates($origin, $destination, $couriers, $items);

跟踪

// tracking by order id
$tracking = $client->tracking($biteshipOrderId);

// or tracking by waybill and courier code
$tracking = $client->publicTracking($waybillId, $courierCode);

订单

创建、检索、更新和删除订单尚未支持

更多关于 Biteship API 文档 的信息