Download the PHP package overbeck/logistics without Composer

On this page you can find all versions of the php package overbeck/logistics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package logistics

logistics

A quick library for querying express logistics information.

Build Status StyleCI build status

Anurag's github stats

简介

用于快捷查询快递物流信息,返回统一格式,无需担心字段格式不一致导致的各种问题

支持平台

目前支持以下平台

环境依赖

安装

使用

配置与使用

快速使用示例

物流公司

如果传入物流公司名称,可以快速锁定物流单号,无需额外的http请求第三方网关获取,减少开销

默认提供 /vendor/overbeck/logistics/src/config/company.php 物流公司列表文件,已包含一些常用的物流公司与物流公司code ,允许用户自定义配置文件或动态设置

文件配置物流公司

congfig.company_file 设置文件路径,支持配置多个文件,并且支持两种格式 ( phpjson )

每种文件格式示例

php

php 格式文件是直接使用 include 关键字引入,所以必须使用return 关键字返回数组

company1.php 内容

json

company1.json 文件内容

动态配置物流公司

当然,你也可以动态直接传入二维数组而不需要额外创建物流公司配置文件

注意:不管你是直接传入数据还是配置文件,都需要保持与上述示例中的数据结构一致,如果物流公司名称和已有的物流公司名称(name)一样,则会替代已有的物流公司

获取物流公司列表

你可以获取所有的物流公司列表

也可以获取默认的物流公司列表

可用网关

一般情况下,可用网关是在配置文件中读取,你也可以直接传递第三个参数指定网关

注意:如果传递的网关不可用,会抛出 \Overbeck\Logistics\Exceptions\InvalidArgumentException 异常

禁用网关

如果你配置的网关很多,你也可以临时禁用某些网关,只需要在 config.disable 配置需要禁用的网关即可

默认网关

当你只是使用一个网关时,可以直接配置默认网关即可

注意:如果配置了默认网关,那么其他网关都会失效,只有默认网关会有效

响应结果

统一返回一个二维数组,数组中的值是每个网关的结果集,它是 \Overbeck\Logistics\Supports\Collection 结果集对象

读取信息

result.status 说明

值(status) 名称(status_name) 解析
99 快递查询异常 请求发送成功,但是业务查询失败,具体原因查看 original_data 的原数据
1 快递收件(揽件) 货物已由快递公司揽收
2 运输中 货物处于运输过程中
3 派件中 货物正在进行派件
4 已签收 正常签收
5 疑难件 网关无法解析或解析错误的状态,最好需要人工核实
6 退件签收 货物退回发货人并签收
7 拒签 收件人明确拒收
8 退回 货物正处于返回发货人的途中
9 超时件 货物派送超时
10 派送失败 货物派送失败,具体原因联系快递公司

异常处理

系统定义三个异常类

\Overbeck\Logistics\Exceptions\InvalidArgumentException 用于处理参数错误异常

\Overbeck\Logistics\Exceptions\GatewayErrorException 用于处理请求网关响应数据错误

\Overbeck\Logistics\Exceptions\GatewayAvailableException 当所有可用网关都不能使用时,抛出该异常

\Overbeck\Logistics\Exceptions\GatewayErrorException\Overbeck\Logistics\Exceptions\GatewayAvailableException 都提供了一个 getResults() 函数获取远程请求返回的信息

\Overbeck\Logistics\Exceptions\GatewayAvailableException 还实现 Overbeck\Logistics\Interfaces\GatewayAvailableInterface 接口,提供几个有用的函数

Laravel 应用

1. 注册服务

config/app.php 注册 ServiceProviderFacade ( Laravel 5.5 + 无需手动注册,可跳过此步)

2. 发布配置文件

修改应用根目录下的 config/logistics.php 中对应的参数即可。

3. 门面

门面类是 \Overbeck\Logistics\Laravel\Logistics

示例

参考与鸣谢

最后

欢迎提出 IssuePull request,也可以留言[email protected]

License

MIT


All versions of logistics with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-openssl Version *
ext-json Version *
ext-simplexml Version *
guzzlehttp/guzzle Version ^6.3||^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package overbeck/logistics contains the following files

Loading the files please wait ....