wing328 / petstore-php
dev-master
2016-05-14 08:30 UTC
Requires
- php: >=5.4
- ext-curl: *
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: ~4.8
- satooshi/php-coveralls: ~1.0
- squizlabs/php_codesniffer: ~2.6
This package is not auto-updated.
Last update: 2024-09-14 19:36:39 UTC
README
这是一个示例服务器Petstore服务器。您可以在 <a href="https://swagger.org.cn" rel="nofollow noindex noopener external ugc">https://swagger.org.cn</a> 或在 irc.freenode.net, #swagger 上了解更多关于Swagger的信息。对于此示例,您可以使用api密钥 "special-key" 来测试授权过滤器
此PHP包由 Swagger Codegen 项目自动生成
- API版本:1.0.0
- 包版本
- 构建日期:2016-05-14T16:30:17.562+08:00
- 构建包:class io.swagger.codegen.languages.PhpClientCodegen
需求
PHP 5.4.0 及以上版本
安装 & 使用
Composer
要通过 Composer 安装绑定,请将以下内容添加到 composer.json
{
"repositories": [
{
"type": "git",
"url": "https://github.com/wing328/petstore-php.git"
}
],
"require": {
"wing328/petstore-php": "*@dev"
}
}
然后运行 composer install
手动安装
下载文件并包含 autoload.php
require_once('/path/to/SwaggerClient-php/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit lib/Tests
入门指南
请按照 安装说明 进行操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: petstore_auth Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\Api\PetApi(); $body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store try { $api_instance->addPet($body); } catch (Exception $e) { echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), "\n"; } ?>
API端点文档
所有URI均相对于 http://petstore.swagger.io/v2
模型文档
授权文档
api_key
- 类型: API密钥
- API密钥参数名: api_key
- 位置: HTTP头
petstore_auth
- 类型: OAuth
- 流程: 隐式
- 授权URL: http://petstore.swagger.io/api/oauth/dialog
- 作用域:
- write:pets: 修改您账户中的宠物
- read:pets: 读取您的宠物