luciano-jr / swagger-php-skd-test
dev-master
2017-11-14 16:12 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is not auto-updated.
Last update: 2024-09-20 02:04:30 UTC
README
这是一个示例服务器Petstore服务器。您可以在https://swagger.org.cn或irc.freenode.net, #swagger上了解更多关于Swagger的信息。对于此示例,您可以使用api密钥special-key
来测试授权过滤器。
此PHP包由Swagger Codegen项目自动生成
- API版本:1.0.0
- 构建包:io.swagger.codegen.languages.PhpClientCodegen
要求
PHP 5.5及以后版本
安装与使用
Composer
要通过Composer安装绑定,请将以下内容添加到composer.json
{
"repositories": [
{
"type": "git",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],
"require": {
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
}
}
然后运行composer install
手动安装
下载文件并包含autoload.php
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门指南
请按照安装过程进行操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: petstore_auth $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Swagger\Client\Api\PetApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store try { $apiInstance->addPet($body); } catch (Exception $e) { echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), PHP_EOL; } ?>
API端点文档
所有URI均相对于http://petstore.swagger.io/v2
模型文档
授权文档
api_key
- 类型: API密钥
- API密钥参数名: api_key
- 位置: HTTP头
petstore_auth
- 类型: OAuth
- 流程: 隐式
- 授权URL: http://petstore.swagger.io/oauth/dialog
- 作用域:
- write:pets: 修改您的账户中的宠物
- read:pets: 读取您的宠物