diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java index 17049ab33890..5f5bb29073b8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java @@ -118,6 +118,9 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen { additionalProperties.put("middlewarePackage", middlewarePackage); + // make middleware src path available in mustache template + additionalProperties.put("middlewareSrcPath", "." + File.separator + toSrcPath(middlewarePackage, srcBasePath)); + supportingFiles.add(new SupportingFile("README.mustache", getPackagePath(), "README.md")); supportingFiles.add(new SupportingFile("composer.mustache", getPackagePath(), "composer.json")); supportingFiles.add(new SupportingFile("index.mustache", getPackagePath(), "index.php")); diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache index 4f701ed19261..ae1f841619f7 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache @@ -7,4 +7,15 @@ is an example of building a PHP Slim server. This example uses the [Slim Framework](http://www.slimframework.com/). To see how to make this your own, please take a look at the template here: -[TEMPLATES](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/slim/) +[TEMPLATES](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/php-slim-server/) + +{{#authMethods}} +{{^hasMore}} +## Authentication +{{/hasMore}} +{{/authMethods}} +{{#authMethods}} +{{#isBasic}} +> Important! To make Basic Authentication work you need to implement `verifyCredentials` method in [AuthBasic]({{middlewareSrcPath}}\AuthBasic.php) class. +{{/isBasic}} +{{/authMethods}}