mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-19 23:30:56 +00:00
132 lines
4.5 KiB
Plaintext
132 lines
4.5 KiB
Plaintext
# {{packagePath}}
|
|
{{#appDescription}}
|
|
{{{appDescription}}}
|
|
{{/appDescription}}
|
|
|
|
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
|
|
|
- API version: {{appVersion}}
|
|
- Package version: {{artifactVersion}}
|
|
- Build date: {{generatedDate}}
|
|
- Build package: {{generatorClass}}
|
|
{{#infoUrl}}
|
|
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
|
{{/infoUrl}}
|
|
|
|
## Requirements
|
|
|
|
PHP 5.4.0 and later
|
|
|
|
## Installation & Usage
|
|
### Composer
|
|
|
|
To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`:
|
|
|
|
```
|
|
{
|
|
"repositories": [
|
|
{
|
|
"type": "git",
|
|
"url": "https://github.com/{{#composerVendorName}}{{.}}{{/composerVendorName}}{{^composerVendorName}}{{gitUserId}}{{/composerVendorName}}/{{#composerProjectName}}{{.}}{{/composerProjectName}}{{^composerProjectName}}{{gitRepoId}}{{/composerProjectName}}.git"
|
|
}
|
|
],
|
|
"require": {
|
|
"{{#composerVendorName}}{{.}}{{/composerVendorName}}{{^composerVendorName}}{{gitUserId}}{{/composerVendorName}}/{{#composerProjectName}}{{.}}{{/composerProjectName}}{{^composerProjectName}}{{gitRepoId}}{{/composerProjectName}}": "*@dev"
|
|
}
|
|
}
|
|
```
|
|
|
|
Then run `composer install`
|
|
|
|
### Manual Installation
|
|
|
|
Download the files and include `autoload.php`:
|
|
|
|
```php
|
|
require_once('/path/to/{{packagePath}}/autoload.php');
|
|
```
|
|
|
|
## Tests
|
|
|
|
To run the unit tests:
|
|
|
|
```
|
|
composer install
|
|
./vendor/bin/phpunit lib/Tests
|
|
```
|
|
|
|
## Getting Started
|
|
|
|
Please follow the [installation procedure](#installation--usage) and then run the following:
|
|
|
|
```php
|
|
<?php
|
|
require_once(__DIR__ . '/vendor/autoload.php');
|
|
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
|
|
// Configure HTTP basic authorization: {{{name}}}
|
|
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
|
|
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}}
|
|
// Configure API key authorization: {{{name}}}
|
|
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY');
|
|
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
|
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
|
|
// Configure OAuth2 access token for authorization: {{{name}}}
|
|
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}}
|
|
{{/hasAuthMethods}}
|
|
|
|
$api_instance = new {{invokerPackage}}\Api\{{classname}}();
|
|
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
|
{{/allParams}}
|
|
|
|
try {
|
|
{{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
|
print_r($result);{{/returnType}}
|
|
} catch (Exception $e) {
|
|
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), "\n";
|
|
}
|
|
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
|
?>
|
|
```
|
|
|
|
## Documentation for API Endpoints
|
|
|
|
All URIs are relative to *{{basePath}}*
|
|
|
|
Class | Method | HTTP request | Description
|
|
------------ | ------------- | ------------- | -------------
|
|
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
|
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
|
|
|
## Documentation For Models
|
|
|
|
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md)
|
|
{{/model}}{{/models}}
|
|
|
|
## Documentation For Authorization
|
|
|
|
{{^authMethods}} All endpoints do not require authorization.
|
|
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
|
{{#authMethods}}## {{{name}}}
|
|
|
|
{{#isApiKey}}- **Type**: API key
|
|
- **API key parameter name**: {{{keyParamName}}}
|
|
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
|
{{/isApiKey}}
|
|
{{#isBasic}}- **Type**: HTTP basic authentication
|
|
{{/isBasic}}
|
|
{{#isOAuth}}- **Type**: OAuth
|
|
- **Flow**: {{{flow}}}
|
|
- **Authorization URL**: {{{authorizationUrl}}}
|
|
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
|
{{#scopes}} - **{{{scope}}}**: {{{description}}}
|
|
{{/scopes}}
|
|
{{/isOAuth}}
|
|
|
|
{{/authMethods}}
|
|
|
|
## Author
|
|
|
|
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
|
{{/hasMore}}{{/apis}}{{/apiInfo}}
|
|
|