syships/php-logistic

The logistic SDK for the php

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:php-extension

1.0.1 2024-09-04 08:19 UTC

This package is auto-updated.

Last update: 2025-06-04 09:51:58 UTC


README

This is a personal plugin for study. It is strongly recomended that you DO NOT use it. This plugin is UNSTABLE.

It is the logistic plugin for php

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist syships/php-logistic "*"

or add

"syships/php-logistic": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

require_once __DIR__.'/vendor/autoload.php';

use Symfony\Component\HttpFoundation\Response;
use syships\logistic\LogisticApplication;

$config = [
    'company_name'=>'中通',
    'app_id'=>'app_id',
    'app_secret'=>'app_secret',
    'server_url'=>'http://japi-test.zto.com/',
];
$data = [
    'waybill_code'=>"73100135377958",//运单号
];
$logisticApp = new LogisticApplication($companyName,$config);

if($logisticApp->track($data)){
    $response = new Response(json_encode($logisticApp->getSuccessData()),200,['Content-Type'=>'application/json']);
    $response->send();
}else{
    $response = new Response($logisticApp->getFirstError(),400,['Content-Type'=>'application/json']);
    $response->send();
}