All Projects → uuk020 → Logistics

uuk020 / Logistics

PHP 多接口获取快递物流信息包

Labels

Projects that are alternatives of or similar to Logistics

The-PHP-Workshop
A New, Interactive Approach to Learning PHP
Stars: ✭ 30 (-89.55%)
Mutual labels:  composer
php-dom-wrapper
Simple DOM wrapper library to manipulate and traverse HTML documents similar to jQuery
Stars: ✭ 103 (-64.11%)
Mutual labels:  composer
Catch Admin
CatchAdmin是一款基于thinkphp6 和 element admin 开发的后台管理系统,基于 ServiceProvider,系统模块完全接耦。随时卸载安装模块。提供了完整的权限和数据权限等功能,大量内置的开发工具提升你的开发体验。官网地址:
Stars: ✭ 264 (-8.01%)
Mutual labels:  composer
terminus-pancakes-plugin
Terminus Plugin to open Pantheon Site Databases in your Favorite SQL Client
Stars: ✭ 22 (-92.33%)
Mutual labels:  composer
aplus
Aplus Command Line Tool
Stars: ✭ 71 (-75.26%)
Mutual labels:  composer
Typo3 Console
Console command for TYPO3 CMS
Stars: ✭ 254 (-11.5%)
Mutual labels:  composer
video-downloader
Video Downloader for Facebook.
Stars: ✭ 63 (-78.05%)
Mutual labels:  composer
Repman
Repman - PHP Repository Manager: packagist proxy and host for private packages
Stars: ✭ 277 (-3.48%)
Mutual labels:  composer
conso
💢 PHP console applications for cool kids 💢
Stars: ✭ 40 (-86.06%)
Mutual labels:  composer
Php Aws Ses
PHP classes that interfaces Amazon Simple Email Service
Stars: ✭ 263 (-8.36%)
Mutual labels:  composer
arabicdatetime
An easy and useful tool to get Arabic date with Arabic characters for Laravel.
Stars: ✭ 39 (-86.41%)
Mutual labels:  composer
client-php
Official NFe.io API Client for PHP
Stars: ✭ 36 (-87.46%)
Mutual labels:  composer
Certainty
Automated cacert.pem management for PHP projects
Stars: ✭ 255 (-11.15%)
Mutual labels:  composer
phpdoc-vuepress
🎨 Template for generating your PHP API documentation in a pretty VuePress format
Stars: ✭ 19 (-93.38%)
Mutual labels:  composer
Laravel Translator
An Eloquent translator for Laravel
Stars: ✭ 275 (-4.18%)
Mutual labels:  composer
ecommerce
Laravel open source e-commerce system.
Stars: ✭ 209 (-27.18%)
Mutual labels:  composer
AmazonProductAPI
PHP library to retrieve products from the Amazon Product API
Stars: ✭ 122 (-57.49%)
Mutual labels:  composer
Graby
Graby helps you extract article content from web pages
Stars: ✭ 281 (-2.09%)
Mutual labels:  composer
Mozart
Developers tool for WordPress plugins: Wraps all your projects dependencies in your own namespace, in order to prevent conflicts with other plugins loading the same dependencies in different versions.
Stars: ✭ 277 (-3.48%)
Mutual labels:  composer
Acf Pro Installer
A composer install helper for Advanced Custom Fields PRO
Stars: ✭ 265 (-7.67%)
Mutual labels:  composer

Logistics

简单便捷查询运单快递信息

Build Status StyleCI build status Latest Stable Version Total Downloads Latest Unstable Version License

支持查询接口平台

平台 次数 是否需要快递公司编码
快递100 100单/天(免费) Y
快递鸟 3000单/天(免费) Y
聚合数据 100次(首次申请) Y
极速数据 1000次(免费) N
数据智汇 100次(免费) N

配置须知

  • 只有快递鸟申请后会有两个,一个是用户ID, 填入到app_secret,另外一个则是api_key, 填入app_key, 其他则把申请的key填入到app_key

环境需求

  • PHP >= 7.0

安装

$ composer require wythe/logistics -vvv

使用

use Wythe\Logistics\Logistics;
$config = [
    'juhe' => ['app_key' => 'app_key', 'vip' => false],
    'shujuzhihui' => ['app_key' => 'app_key', 'vip' => false],
    'jisu' => ['app_key' => 'app_key', 'vip' => false],
    'kuaidibird' => ['app_key' => 'app_key', 'app_secret' =>  'app_secret', 'vip' =>
            false],
    'kuaidi100' => ['app_key' => '']
];
$logistics = new Logistics($config);

参数说明

array query(string $code, $channels = ['kuaidi100'], string $company = '')
array queryByProxy(array $proxy, string $code, $channels = ['kuaidi100'], string $company = '')
  • query 与 queryByProxy 返回数组结构是一样, 只是多了一个参数代理IP
  • $proxy - 代理地址 结构: ['proxy' => '代理IP:代理端口']
  • $code - 运单号
  • $channel - 渠道名称, 可选参数,默认快递鸟.
  • $company - 快递公司 具体看 SupportLogistics 文件

快递 100 接口获取物流信息 所有接口返回格式是统一

use Wythe\Logistics\Logistics;
$config = [
    'juhe' => ['app_key' => 'app_key', 'vip' => false],
    'shujuzhihui' => ['app_key' => 'app_key', 'vip' => false],
    'jisu' => ['app_key' => 'app_key', 'vip' => false],
    'kuaidibird' => ['app_key' => 'app_key', 'app_secret' =>  'app_secret', 'vip' =>
            false],
    'kuaidi100' => ['app_key' => '']
];
$logistics = new Logistics($config);
$logistics->query('12313131231', ''); // 第二参数选填,可以为字符串或数组, 默认快递鸟
$logistics->query('12313131231', 'kuaidi100');
$logistics->query('12313131231', ['kuaidi100']);

示例:

[
   'kuaidi100' => [
       'channel' => 'kuaidi100',
       'status' => 'success',
       'result' => [
           [
               'status' => 200,
               'message'  => 'OK',
               'error_code' => 0,
               'data' => [
                   ['time' => '2019-01-09 12:11', 'description' => '仓库-已签收'],
                   ['time' => '2019-01-07 12:11', 'description' => '广东XX服务点'],
                   ['time' => '2019-01-06 12:11', 'description' => '广东XX转运中心']
               ],
               'logistics_company' => '申通快递',
               'logistics_bill_no' => '12312211'
           ],
           [
               'status' => 201,
               'message' => '快递公司参数异常:单号不存在或者已经过期',
               'error_code' => 0,
               'data' => '',
               'logistics_company' => '',
               'logistics_bill_no' => ''
           ]
       ]
   ]
]

多接口获取物流信息

use Wythe\Logistics\Logistics;
$config = [
    'juhe' => ['app_key' => 'app_key', 'vip' => false],
    'shujuzhihui' => ['app_key' => 'app_key', 'vip' => false],
    'jisu' => ['app_key' => 'app_key', 'vip' => false],
    'kuaidibird' => ['app_key' => 'app_key', 'app_secret' =>  'app_secret', 'vip' =>
            false],
    'kuaidi100' => ['app_key' => '']
];
$logistics = new Logistics($config);
$logistics->query('12313131231');
$logistics->query('12313131231', ['kuaidi100', 'ickd']);

示例:

[
   'kuaidi100' => [
       'channel' => 'kuaidi100',
       'status' => 'success',
       'result' => [
           [
               'status' => 200,
               'message'  => 'OK',
               'error_code' => 0,
               'data' => [
                   ['time' => '2019-01-09 12:11', 'description' => '仓库-已签收'],
                   ['time' => '2019-01-07 12:11', 'description' => '广东XX服务点'],
                   ['time' => '2019-01-06 12:11', 'description' => '广东XX转运中心']
               ],
               'logistics_company' => '申通快递',
               'logistics_bill_no' => '12312211'
           ],
           [
               'status' => 201,
               'message' => '快递公司参数异常:单号不存在或者已经过期',
               'error_code' => 0,
               'data' => '',
               'logistics_company' => '',
               'logistics_bill_no' => ''
           ]
       ]
   ],
   'ickd' => [
       'channel' => 'ickd',
       'status' => 'success',
       'result' => [
           [
               'status' => 200,
               'message'  => 'OK',
               'error_code' => 0,
                'data' => [
                    ['time' => '2019-01-09 12:11', 'description' => '仓库-已签收'],
                    ['time' => '2019-01-07 12:11', 'description' => '广东XX服务点'],
                    ['time' => '2019-01-06 12:11', 'description' => '广东XX转运中心']
                ],
                'logistics_company' => '申通快递',
                'logistics_bill_no' => '12312211'
           ]
       ]
   ]
]

参考

最后

欢迎提出 issue 和 pull request

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].