GithubHelp home page GithubHelp logo

express's Introduction

Express

支持快递鸟、快递100的快递查询SDK

Build Status StyleCI build status Latest Stable Version Total Downloads License

安装

$ composer require flex/express -vvv

配置

在使用本扩展之前,你需要去 快递100 或者 快递鸟 注册申请,获取到APP_id和APP_key。

Usage

快递100

use Flex\Express\Express100;

$express = new Express100('app_id','app_key');
$info = $express->track($tracking_code, $shipping_code, $phone); //快递单号 物流公司编号 收件人手机号(顺丰必填 其他快递选填)

示例:

{
    "message": "ok",
    "nu": "888888888888",
    "ischeck": "1",
    "condition": "F00",
    "com": "shunfeng",
    "status": "200",
    "state": "3",
    "data": [
        {
            "time": "2019-03-08 19:11:51",
            "ftime": "2019-03-08 19:11:51",
            "context": "[安高广场速运营业点]快件已发车"
        },
        {
            "time": "2019-03-08 18:56:12",
            "ftime": "2019-03-08 18:56:12",
            "context": "[安高广场速运营业点]快件在【合肥蜀山区安高广场营业点】已装车,准备发往 【合肥经开集散中心】"
        },
        {
            "time": "2019-03-08 18:50:52",
            "ftime": "2019-03-08 18:50:52",
            "context": "[安高广场速运营业点]顺丰速运 已收取快件"
        }
    ]
}

快递鸟

use Flex\Express\ExpressBird;

$express = new ExpressBird('app_id','app_key'); 
$info = $express->track($tracking_code, $shipping_code,$order_code); //快递单号 物流公司编号 订单编号(选填)

示例:

{
    "LogisticCode": "8888888888888888",
    "ShipperCode": "YTO",
    "Traces": [
        {
            "AcceptStation": "【四川省直营市场部公司】 取件人: 四川省直营市场部41 已收件",
            "AcceptTime": "2019-03-21 11:03:40"
        },
        {
            "AcceptStation": "【四川省直营市场部公司】 已收件",
            "AcceptTime": "2019-03-21 13:45:01"
        },
        {
            "AcceptStation": "【成都转运中心】 已收入",
            "AcceptTime": "2019-03-21 22:40:01"
        }
    ],
    "State": "3",
    "OrderCode": "",
    "EBusinessID": "100000",
    "Success": true
}

通用方法

use Flex\Express\Express;


$express = new Express($app_id,$app_key,$type); //$type支持类型'express100'、'expressbird'

//快递鸟$additional=['order_code'=>111111] 快递100 $additional=['phone'=>'18899996666']
$info = $express->track($tracking_code, $shipping_code,$additional); ////查询物流 快递单号 额外参数

在 Laravel 中使用

在 Laravel 中使用也是同样的安装方式,配置写在 config/services.php 中:

    .
    .
    .
     'express' => [
        'id' => env('EXPRESS_ID'),
        'key' => env('EXPRESS_KEY'),
        'type' => env('EXPRESS_TYPE'),
    ],

然后在 .env 中配置 EXPRESS_IDEXPRESS_KEYEXPRESS_TYPE

EXPRESS_ID=xxxxxxxxxxxxxxxxxxxxx
EXPRESS_KEY=xxxxxxxxxxxxxxxxxxxxx
EXPRESS_TYPE=express100

可以用两种方式来获取 Flex\Express\Express 实例:

方法参数注入

    .
    .
    .
    public function edit(Express $express) 
    {
        $response = $express->track('888888888','YTO');
    }
    .
    .
    .

服务名访问

    .
    .
    .
    public function edit() 
    {
        $response = app('express')->track('888888888','YTO');
    }
    .
    .
    .

参考

License

MIT

express's People

Contributors

inbjo avatar zhyfor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

express's Issues

为什么要限制一些快递呢?

$allow_shipping_code = ['youzhengguonei', 'youzhengguoji', 'ems', 'emsguoji', 'emsinten', 'bjemstckj', 'shunfeng', 'shentong', 'yuantong', 'zhongtong', 'huitongkuaidi', ......]
这里面没有极兔jtexpress 没有丰网,是因为时间的原因么

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.