diff --git a/modules/swagger-codegen/src/main/resources/php/README.mustache b/modules/swagger-codegen/src/main/resources/php/README.mustache index 12b78b3f7ed..27e76e1ac3c 100644 --- a/modules/swagger-codegen/src/main/resources/php/README.mustache +++ b/modules/swagger-codegen/src/main/resources/php/README.mustache @@ -1,4 +1,17 @@ # {{packagePath}} +{{#appDescription}} +{{{appDescription}}} +{{/appDescription}} + +This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API verion: {{appVersion}} +- Package version: {{artifactVersion}} +- Build date: {{generatedDate}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} ## Requirements @@ -40,6 +53,39 @@ composer install ./vendor/bin/phpunit lib/Tests ``` +## Getting Started + +Please follow the installation procedure and then run the following: + +```php +setUsername('YOUR_USERNAME'); +{{{invokerPackage}}}::getDefaultConfiguration->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}} +// Configure API key authorization: {{{name}}} +{{{invokerPackage}}}::getDefaultConfiguration->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// {{{invokerPackage}}}::getDefaultConfiguration->setApiKeyPrefix('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}} +// Configure OAuth2 access token for authorization: {{{name}}} +{{{invokerPackage}}}::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}} +{{/hasAuthMethods}} + +$api_instance = new {{invokerPackage}}\{{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}}* diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index ad2d507949f..addcbc63f39 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -1,4 +1,12 @@ # SwaggerClient-php +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API verion: 1.0.0 +- Package version: 1.0.0 +- Build date: 2016-03-17T16:51:52.647+08:00 +- Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -40,6 +48,29 @@ composer install ./vendor/bin/phpunit lib/Tests ``` +## Getting Started + +Please follow the installation procedure and then run the following: + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + +$api_instance = new Swagger\Client\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"; +} + +?> +``` + ## Documentation for API Endpoints All URIs are relative to *http://petstore.swagger.io/v2*