{"id":15296317,"url":"https://github.com/zacksleo/suning-sdk","last_synced_at":"2026-02-08T15:32:15.418Z","repository":{"id":57089050,"uuid":"197168348","full_name":"zacksleo/suning-sdk","owner":"zacksleo","description":"🦁️苏宁开放平台SDK","archived":false,"fork":false,"pushed_at":"2019-07-26T02:56:41.000Z","size":347,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-25T02:54:27.422Z","etag":null,"topics":["php7","sdk","suning","suning-sdk"],"latest_commit_sha":null,"homepage":"https://open.suning.com/ospos/apipage/toApiListMenu.do","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zacksleo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-16T09:58:42.000Z","updated_at":"2020-03-31T08:17:53.000Z","dependencies_parsed_at":"2022-08-20T16:00:33.151Z","dependency_job_id":null,"html_url":"https://github.com/zacksleo/suning-sdk","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zacksleo/suning-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fsuning-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fsuning-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fsuning-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fsuning-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zacksleo","download_url":"https://codeload.github.com/zacksleo/suning-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Fsuning-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29235246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T14:18:14.570Z","status":"ssl_error","status_checked_at":"2026-02-08T14:18:14.071Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["php7","sdk","suning","suning-sdk"],"created_at":"2024-09-30T18:10:02.942Z","updated_at":"2026-02-08T15:32:15.402Z","avatar_url":"https://github.com/zacksleo.png","language":"PHP","readme":"\u003ch1 align=\"center\"\u003e suning-sdk \u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e 苏宁开放平台 SDK\u003c/p\u003e\n\n\n## Installing\n\n```shell\n$ composer require zacksleo/suning-sdk -vvv\n```\n\n## Usage\n\n### 1. 初始化客户端\n\n```php\n\nuse Zacksleo\\SuningSdk\\Suning;\n\n$suning = new Suning([\n    'key'        =\u003e 'key',\n    'secret'     =\u003e 'secret',\n    'debug'      =\u003e false,\n    'log' =\u003e [\n        'file'       =\u003e __DIR__.'/suning.log',\n        'level'      =\u003e 'error',\n        'permission' =\u003e 0777,\n    ]\n]);\n\n```\n\n### 2.1 链式调用方式\n\n\u003e 该方式支持类型提示和自动补全\n\n```php\n$response = $suning-\u003ecustom-\u003elogisticcompany-\u003eget(['companyName' =\u003e '申通快递',]);\n```\n\n### 2.2 标准调用方式\n\n```php\n$response = $suning-\u003erequest([\n    'suning.custom.logisticcompany.get' =\u003e 'logisticCompany'\n], [\n    'companyName' =\u003e '申通快递',\n]);\n```\n\n\u003e 第一个参数如果是数组，key 为 ApiMethodName, value 为 BizName。第二个参数对应[官方文档示例中](http://open.suning.com/ospos/apipage/toApiListMenu.do) 请求参数的值\n\n以上调用可省略为\n\n```php\n$response = $suning-\u003erequest('suning.custom.logisticcompany.get', [ 'companyName' =\u003e '申通快递' ]);\n```\n\n 或\n\n```php\n$response = $suning-\u003erequest('custom.logisticcompany.get', [ 'companyName' =\u003e '申通快递', ]);\n```\n\n\u003e 注意：除标准调用方式外，其他调用方式需要确保 [map.php](https://github.com/zacksleo/suning-sdk/blob/master/src/map.php) 文件中存在对应的值。如果没有，欢迎PR.\n\n### 输出格式\n\n返回值取出的是 sn_header 及 sn_body, 如果不存在 sn_header， 给给予默认值\n\n```bash\narray:2 [\n  \"header\" =\u003e array:4 [\n    \"pageTotal\" =\u003e 1\n    \"pageNo\" =\u003e 1\n    \"totalSize\" =\u003e 1\n    \"returnMessage\" =\u003e \"\"\n  ]\n  \"body\" =\u003e array:2 [\n    \"expressCompanyName\" =\u003e \"申通快递\"\n    \"expressCompanyCode\" =\u003e \"S01\"\n  ]\n]\n\n```\n\n### 异常处理\n\n```php\ntry {\n    $response = $suning-\u003ecustom-\u003elogisticcompany-\u003eget([\n        'companyName' =\u003e '申通快递',\n    ]);\n} catch (\\Exception $exception) {\n    var_dump($exception-\u003egetMessage());\n}\n```\n\n## 命令行工具\n\n### 生成 map.php 文件\n\n```bash\nphp ./bin/suning map:generate\n```\n\n### 生成 fake:generate 用的 map-fake.php 文件\n\n```bash\nphp ./bin/suning map:generate --fake\n```\n\n### 生成用于代码补全提示的类\n\n```bash\nphp ./bin/suning fake:generate\n```\n\n## Contributing\n\nYou can contribute in one of three ways:\n\n1. File bug reports using the [issue tracker](https://github.com/zacksleo/suning-sdk/issues).\n2. Answer questions or fix bugs on the [issue tracker](https://github.com/zacksleo/suning-sdk/issues).\n3. Contribute new features or update the wiki.\n\n_The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable._\n\n## License\n\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksleo%2Fsuning-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzacksleo%2Fsuning-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksleo%2Fsuning-sdk/lists"}