{"id":13536281,"url":"https://github.com/thisliu/logistics","last_synced_at":"2025-04-05T00:10:11.139Z","repository":{"id":41275478,"uuid":"185047335","full_name":"thisliu/logistics","owner":"thisliu","description":"Logistics query extension package","archived":false,"fork":false,"pushed_at":"2023-01-29T14:43:05.000Z","size":104,"stargazers_count":186,"open_issues_count":6,"forks_count":29,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T10:01:49.067Z","etag":null,"topics":["logistics","logistics-company"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thisliu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-05T15:13:23.000Z","updated_at":"2024-05-22T09:52:12.000Z","dependencies_parsed_at":"2023-02-15T23:15:58.348Z","dependency_job_id":null,"html_url":"https://github.com/thisliu/logistics","commit_stats":null,"previous_names":["finecho/logistics"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisliu%2Flogistics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisliu%2Flogistics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisliu%2Flogistics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisliu%2Flogistics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thisliu","download_url":"https://codeload.github.com/thisliu/logistics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266565,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logistics","logistics-company"],"created_at":"2024-08-01T09:00:36.708Z","updated_at":"2025-04-05T00:10:11.124Z","avatar_url":"https://github.com/thisliu.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"\u003ch1\u003e❤️ Logistics\u003c/h1\u003e\n\n\u003cp\u003e快递物流查询-快递查询接口组件。\u003c/p\u003e\n\t\n[![Build Status](https://travis-ci.org/finecho/logistics.svg?branch=master)](https://travis-ci.org/finecho/logistics)\t\n[![Latest Stable Version](https://poser.pugx.org/finecho/logistics/v/stable)](https://packagist.org/packages/finecho/logistics)\n[![Total Downloads](https://poser.pugx.org/finecho/logistics/downloads)](https://packagist.org/packages/finecho/logistics)\n[![Latest Unstable Version](https://poser.pugx.org/finecho/logistics/v/unstable)](https://packagist.org/packages/finecho/logistics)\n[![License](https://poser.pugx.org/finecho/logistics/license)](https://packagist.org/packages/finecho/logistics)\n\n## 介绍\n \n 目前已支持四家平台\n \n * [阿里云](https://homenew.console.aliyun.com/)\n * [聚合数据](https://www.juhe.cn/docs/api/id/43)\n * [快递100](https://www.kuaidi100.com/)\n * [快递鸟](https://www.kdniao.com/)\n\n## 安装\t\n\n```\n$ composer require finecho/logistics -vvv\t\n```\t\n\n## 使用\t\n\n```php\t\nrequire __DIR__ .'/vendor/autoload.php';\n\nuse Finecho\\Logistics\\Logistics;\n\n$config = [\n    'provider' =\u003e 'aliyun', // aliyun/juhe/kd100\n    \n    'aliyun' =\u003e [\n        'app_code' =\u003e 'xxxxxxxx',\n    ],\n    \n    'juhe' =\u003e [\n         'app_code' =\u003e 'xxxxx',\n    ],\n    \n    'kdniao' =\u003e [\n             'app_code' =\u003e 'xxxxx',\n             'customer' =\u003e 'xxxxx',\n    ],\n        \n    'kd100' =\u003e [\n         'app_code' =\u003e 'xxxxx',\n         'customer' =\u003e 'xxxxx',\n    ],\n];\n\n$logistics = new Logistics($config);\n```\t\n\n###  获取物流公司列表\n \n```php\t\n$companies = $logistics-\u003ecompanies();\t\n```\t\n\n示例:\n\n```json\n[\n    \"顺丰\",\n    \"申通\",\n    \"中通\",\n    \"圆通\"\n]\n```\n\n###  获取物流信息\t\n\n```php\t\n$order = $logistics-\u003equery('805741929402797742', '圆通');\n```\n\n示例：\t\n\n```json\t\n{\n    \"code\": 200,\n    \"msg\": \"OK\",\n    \"company\": \"圆通\",\n    \"no\": \"805741929402797742\",\n    \"status\": 4,\n    \"display_status\": \"已签收\",\n    \"abstract_status\": {\n        \"has_active\" : true,\n        \"has_ended\" : true,\n        \"has_signed\" : true,\n        \"has_troubled\" : false,\n        \"has_returned\" : false\n    },\n    \"list\": [\n        {\n            \"datetime\": \"2019-05-07 18:02:27\",\n            \"remark\": \"山东省淄博市淄川区三部公司取件人:司健（15553333300）已收件\",\n            \"zone\": \"\"\n        },\n        {\n            \"datetime\": \"2019-05-09 12:44:40\",\n            \"remark\": \"快件已签收签收人:邮件收发章感谢使用圆通速递，期待再次为您服务\",\n            \"zone\": \"\"\n        }\n    ],\n    \"original\": {\n        \"resultcode\": \"200\",\n        \"reason\": \"成功的返回\",\n        \"result\": {\n            \"company\": \"圆通\",\n            \"com\": \"yt\",\n            \"no\": \"805741929402797742\",\n            \"status\": \"1\",\n            \"status_detail\": null,\n            \"list\": [\n                {\n                    \"datetime\": \"2019-05-07 18:02:27\",\n                    \"remark\": \"山东省淄博市淄川区三部公司取件人:司健（15553333300）已收件\",\n                    \"zone\": \"\"\n                },\n                {\n                    \"datetime\": \"2019-05-09 12:44:40\",\n                    \"remark\": \"快件已签收签收人:邮件收发章感谢使用圆通速递，期待再次为您服务\",\n                    \"zone\": \"\"\n                }\n            ]\n        },\n        \"error_code\": 0\n    }\n}\n```\t\n你也可以这样获取：\n\n```\n$order['company']; // '圆通' （因为各个平台对公司的名称有所不一致，所以查询结果或许会有些许差别）\n$order['list']; // ....\n$order['original']; // 获取接口原始返回信息\n...\n\n```\n\n或者这样：\n\n```\n$order-\u003egetCode(); // 状态码\n$order-\u003egetMsg(); // 状态信息\n$order-\u003egetCompany(); // 物流公司简称\n$order-\u003egetNo(); // 物流单号\n$order-\u003egetStatus(); // 当前物流单状态 \n\n// 注：物流状态可能不一定准确\n\n$order-\u003egetDisplayStatus(); // 当前物流单状态展示名\n$order-\u003egetAbstractStatus(); // 当前抽象物流单状态\n$order-\u003egetCourier(); // 快递员姓名\n$order-\u003egetCourierPhone(); // 快递员手机号\n$order-\u003egetList(); // 物流单状态详情\n$order-\u003egetOriginal(); // 获取接口原始返回信息\n```\n\n\n### 参数说明\t\n\n```\t\n string   order(string $no, string $company = null)\t\n```\n\u003e - `$no` - 物流单号\t\n\u003e - `$company` - 快递公司名（通过 $companies = $logistics-\u003ecompanies(); 获取)\n\n* `aliyun` ：`$company` 可选\n* `juhe` : `$company` 必填\n* `kd100` : `$company` 可选（建议必填，不填查询结果不一定准确）\n* `kdniao` : `$company` 可选（建议必填，不填查询结果不一定准确）\n\n### 在 Laravel 中使用\t\n\n生成配置文件\n\n```PHP\nphp artisan vendor:publish --provider=\"Finecho\\Logistics\\ServiceProvider\"\n```\n\n然后在 `.env` 中配置 `LOGISTICS_APP_CODE` ，同时修改 config/logistics.php 中配置信息：\t\n\n```env\t\nLOGISTICS_APP_CODE=xxxxxxxxxxxxxxxxx\t\nLOGISTICS_CUSTOMER=xxxxxxxxxxxxxxxxx\t// 快递100 customer\n```\n\n可以用两种方式来获取 `Finecho\\Logistics\\Logistics;` 实例：\t\n\n#### 方法参数注入\t\n\n```php\t\n    .\t\n    .\t\n    .\t\n    public function show(Logistics $logistics, $no, $company) \t\n    {\t\n        $order = $logistics-\u003equery($no, $company);\n        \n        return $order;\t// $order-\u003egetList(); .....\n    }\t\n    .\t\n    .\t\n    .\t\n```\t\n\n#### 服务名访问\t\n\n```php\t\n    .\t\n    .\t\n    .\t\n    public function show($no, $company) \t\n    {\t\n        $response = app('logistics')-\u003equery($no, $company);\t\n    }\t\n    .\t\n    .\t\n    .\n ```\t\n\n## 参考\t\n\n- [PHP 扩展包实战教程 - 从入门到发布](https://learnku.com/courses/creating-package)\t\n- [overtrue/easy-sms](https://github.com/overtrue/easy-sms)\t\n- [icecho/easy-ip](https://github.com/icecho/easy-ip)\t\n\n## 感谢\n\n- 感谢 [超哥](https://github.com/overtrue) 和 [icecho](https://github.com/icecho) 为我第一个扩展包的悉心指导。\n\n## License\t\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisliu%2Flogistics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthisliu%2Flogistics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisliu%2Flogistics/lists"}