diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache index 218f5452ce26..7c09d2cfcc76 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache @@ -1232,6 +1232,27 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + {{#hasHttpSignatureMethods}} + serializeToString(body, formParams, contentType, isBodyNullable), + {{/hasHttpSignatureMethods}} + {{^hasHttpSignatureMethods}} + null, + {{/hasHttpSignatureMethods}} + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1262,27 +1283,6 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - {{#hasHttpSignatureMethods}} - serializeToString(body, formParams, contentType, isBodyNullable), - {{/hasHttpSignatureMethods}} - {{^hasHttpSignatureMethods}} - null, - {{/hasHttpSignatureMethods}} - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/ApiClient.java index b78da38971a9..4fb9fd21e84a 100644 --- a/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/jersey2-oneOf-Mixed/src/main/java/org/openapitools/client/ApiClient.java @@ -1011,6 +1011,22 @@ public ApiResponse invokeAPI( // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1041,22 +1057,6 @@ public ApiResponse invokeAPI( Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/ApiClient.java index b78da38971a9..4fb9fd21e84a 100644 --- a/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/jersey2-oneOf-duplicates/src/main/java/org/openapitools/client/ApiClient.java @@ -1011,6 +1011,22 @@ public ApiResponse invokeAPI( // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1041,22 +1057,6 @@ public ApiResponse invokeAPI( Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java index 9a6871d98ff0..28cba42ad82f 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java @@ -1152,6 +1152,22 @@ public ApiResponse invokeAPI( // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1182,22 +1198,6 @@ public ApiResponse invokeAPI( Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index 9a6871d98ff0..28cba42ad82f 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -1152,6 +1152,22 @@ public ApiResponse invokeAPI( // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1182,22 +1198,6 @@ public ApiResponse invokeAPI( Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index 20637170383c..e0022710c289 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -1060,6 +1060,22 @@ public ApiResponse invokeAPI( // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1090,22 +1106,6 @@ public ApiResponse invokeAPI( Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java index ffa0c9c81fea..643635668569 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java @@ -1011,6 +1011,22 @@ public ApiResponse invokeAPI( // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1041,22 +1057,6 @@ public ApiResponse invokeAPI( Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java index 3e873330d3ba..38dcc7c937b9 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java @@ -1136,6 +1136,22 @@ public ApiResponse invokeAPI( // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1166,22 +1182,6 @@ public ApiResponse invokeAPI( Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/ApiClient.java index 3e873330d3ba..38dcc7c937b9 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger2/src/main/java/org/openapitools/client/ApiClient.java @@ -1136,6 +1136,22 @@ public ApiResponse invokeAPI( // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + null, + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1166,22 +1182,6 @@ public ApiResponse invokeAPI( Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - null, - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index 0f84b73cba16..3234c4bf695e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -1234,6 +1234,22 @@ public ApiResponse invokeAPI( // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(targetURL); + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + if (authNames != null) { + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + serializeToString(body, formParams, contentType, isBodyNullable), + method, + target.getUri()); + } + if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { @@ -1264,22 +1280,6 @@ public ApiResponse invokeAPI( Entity entity = serialize(body, formParams, contentType, isBodyNullable); - // put all headers in one place - Map allHeaderParams = new HashMap<>(defaultHeaderMap); - allHeaderParams.putAll(headerParams); - - if (authNames != null) { - // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - serializeToString(body, formParams, contentType, isBodyNullable), - method, - target.getUri()); - } - for (Entry entry : allHeaderParams.entrySet()) { String value = entry.getValue(); if (value != null) { diff --git a/samples/server/petstore/php-laravel/lib/.editorconfig b/samples/server/petstore/php-laravel/lib/.editorconfig new file mode 100644 index 000000000000..6537ca4677ee --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 diff --git a/samples/server/petstore/php-laravel/lib/.env.example b/samples/server/petstore/php-laravel/lib/.env.example new file mode 100644 index 000000000000..ac748637ae52 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/.env.example @@ -0,0 +1,46 @@ +APP_NAME=Laravel +APP_ENV=local +APP_KEY= +APP_DEBUG=true +APP_URL=http://localhost + +LOG_CHANNEL=stack + +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=laravel +DB_USERNAME=root +DB_PASSWORD= + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +QUEUE_CONNECTION=sync +SESSION_DRIVER=file +SESSION_LIFETIME=120 + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=smtp +MAIL_HOST=smtp.mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS=null +MAIL_FROM_NAME="${APP_NAME}" + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= +PUSHER_APP_CLUSTER=mt1 + +MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" diff --git a/samples/server/petstore/php-laravel/lib/.gitattributes b/samples/server/petstore/php-laravel/lib/.gitattributes new file mode 100644 index 000000000000..967315dd3d16 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/.gitattributes @@ -0,0 +1,5 @@ +* text=auto +*.css linguist-vendored +*.scss linguist-vendored +*.js linguist-vendored +CHANGELOG.md export-ignore diff --git a/samples/server/petstore/php-laravel/lib/.gitignore b/samples/server/petstore/php-laravel/lib/.gitignore new file mode 100644 index 000000000000..42cd73d9573d --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/.gitignore @@ -0,0 +1 @@ +/vendor/ \ No newline at end of file diff --git a/samples/server/petstore/php-laravel/lib/.styleci.yml b/samples/server/petstore/php-laravel/lib/.styleci.yml new file mode 100644 index 000000000000..1db61d96e756 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/.styleci.yml @@ -0,0 +1,13 @@ +php: + preset: laravel + disabled: + - unused_use + finder: + not-name: + - index.php + - server.php +js: + finder: + not-name: + - webpack.mix.js +css: true diff --git a/samples/server/petstore/php-laravel/lib/README.md b/samples/server/petstore/php-laravel/lib/README.md new file mode 100644 index 000000000000..9e8783ef7387 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/README.md @@ -0,0 +1,26 @@ +# OpenAPI generated server + +## Requirements +* PHP 7.2.5 or newer + +## Overview +This server was generated by the [openapi-generator](https://github.com/openapitools/openapi-generator) project. By using the +[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This +is an example of building a PHP server. + +This example uses the [laravel Framework](http://laravel.com/). To see how to make this your own, please take a look at the template here: + +## Installation & Usage +### Composer + +Using `composer install` to install the framework and dependencies via [Composer](http://getcomposer.org/). + +### post installation steps + +Change into application folder and execute following commands to get started: + +```sh +cp .env.example .env +php artisan key:generate +php artisan serve +``` \ No newline at end of file diff --git a/samples/server/petstore/php-laravel/lib/app/Console/Kernel.php b/samples/server/petstore/php-laravel/lib/app/Console/Kernel.php new file mode 100644 index 000000000000..69914e993783 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Console/Kernel.php @@ -0,0 +1,41 @@ +command('inspire')->hourly(); + } + + /** + * Register the commands for the application. + * + * @return void + */ + protected function commands() + { + $this->load(__DIR__.'/Commands'); + + require base_path('routes/console.php'); + } +} diff --git a/samples/server/petstore/php-laravel/lib/app/Exceptions/Handler.php b/samples/server/petstore/php-laravel/lib/app/Exceptions/Handler.php new file mode 100644 index 000000000000..59c585dc134c --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Exceptions/Handler.php @@ -0,0 +1,55 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +namespace app.Http.Controllers; + + +interface AnotherFakeController { + + + /** + * Operation call123TestSpecialTags + * + * To test special tags + * @param \app\Models\Client $client + * @return \app\Models\Client + */ + public function call123TestSpecialTags( + \app\Models\Client $client, + ): + \app\Models\Client + ; + +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/Controller.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/Controller.php new file mode 100644 index 000000000000..a0a2a8a34a62 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/Controller.php @@ -0,0 +1,13 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +namespace app.Http.Controllers; + + +interface DefaultController { + + + /** + * Operation fooGet + * @return \app\Models\FooGetDefaultResponse + */ + public function fooGet( + ): + \app\Models\FooGetDefaultResponse + ; + +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeClassnameTags123Controller.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeClassnameTags123Controller.php new file mode 100644 index 000000000000..ff2f1343bfa4 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeClassnameTags123Controller.php @@ -0,0 +1,40 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +namespace app.Http.Controllers; + + +interface FakeClassnameTags123Controller { + + + /** + * Operation testClassname + * + * To test class name in snake case + * @param \app\Models\Client $client + * @return \app\Models\Client + */ + public function testClassname( + \app\Models\Client $client, + ): + \app\Models\Client + ; + +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php new file mode 100644 index 000000000000..0a9bbb2740c5 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php @@ -0,0 +1,368 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +namespace app.Http.Controllers; + + +interface FakeController { + + + /** + * Operation testClientModel + * + * To test \"client\" model + * @param \app\Models\Client $client + * @return \app\Models\Client + */ + public function testClientModel( + \app\Models\Client $client, + ): + \app\Models\Client + ; + + + /** + * Operation testEndpointParameters + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param float $number + * @param float $double + * @param string $patternWithoutDelimiter + * @param string $byte + * @param null | int $integer + * @param null | int $int32 + * @param null | int $int64 + * @param null | float $float + * @param null | string $string + * @param null | \SplFileObject $binary + * @param null | \DateTime $date + * @param null | \DateTime $dateTime + * @param null | string $password + * @param null | string $callback + * @return | + */ + public function testEndpointParameters( + float $number, + float $double, + string $patternWithoutDelimiter, + string $byte, + ?int $integer, + ?int $int32, + ?int $int64, + ?float $float, + ?string $string, + ?\SplFileObject $binary, + ?\DateTime $date, + ?\DateTime $dateTime, + ?string $password, + ?string $callback, + ): + ; + + + /** + * Operation testEnumParameters + * + * To test enum parameters + * @param null | string[] $enumHeaderStringArray + * @param null | string $enumHeaderString + * @param null | string[] $enumQueryStringArray + * @param null | string $enumQueryString + * @param null | int $enumQueryInteger + * @param null | float $enumQueryDouble + * @param null | \app\Models\EnumClass[] $enumQueryModelArray + * @param null | string[] $enumFormStringArray + * @param null | string $enumFormString + * @return | + */ + public function testEnumParameters( + ?array $enumHeaderStringArray, + ?string $enumHeaderString, + ?array $enumQueryStringArray, + ?string $enumQueryString, + ?int $enumQueryInteger, + ?float $enumQueryDouble, + ?array $enumQueryModelArray, + ?array $enumFormStringArray, + ?string $enumFormString, + ): + ; + + + /** + * Operation testGroupParameters + * + * Fake endpoint to test group parameters (optional) + * @param int $requiredStringGroup + * @param bool $requiredBooleanGroup + * @param int $requiredInt64Group + * @param null | int $stringGroup + * @param null | bool $booleanGroup + * @param null | int $int64Group + * @return + */ + public function testGroupParameters( + int $requiredStringGroup, + bool $requiredBooleanGroup, + int $requiredInt64Group, + ?int $stringGroup, + ?bool $booleanGroup, + ?int $int64Group, + ): + ; + + + /** + * Operation fakeBigDecimalMap + * @return \app\Models\FakeBigDecimalMap200Response + */ + public function fakeBigDecimalMap( + ): + \app\Models\FakeBigDecimalMap200Response + ; + + + /** + * Operation testAdditionalPropertiesReference + * + * test referenced additionalProperties + * @param array $requestBody + * @return + */ + public function testAdditionalPropertiesReference( + array $requestBody, + ): + ; + + + /** + * Operation testBodyWithBinary + * @param \SplFileObject $body + * @return + */ + public function testBodyWithBinary( + \SplFileObject $body, + ): + ; + + + /** + * Operation testBodyWithFileSchema + * @param \app\Models\FileSchemaTestClass $fileSchemaTestClass + * @return + */ + public function testBodyWithFileSchema( + \app\Models\FileSchemaTestClass $fileSchemaTestClass, + ): + ; + + + /** + * Operation testBodyWithQueryParams + * @param string $query + * @param \app\Models\User $user + * @return + */ + public function testBodyWithQueryParams( + string $query, + \app\Models\User $user, + ): + ; + + + /** + * Operation fakeHealthGet + * + * Health check endpoint + * @return \app\Models\HealthCheckResult + */ + public function fakeHealthGet( + ): + \app\Models\HealthCheckResult + ; + + + /** + * Operation fakeHttpSignatureTest + * + * test http signature authentication + * @param \app\Models\Pet $pet + * @param null | string $query1 + * @param null | string $header1 + * @return + */ + public function fakeHttpSignatureTest( + \app\Models\Pet $pet, + ?string $query1, + ?string $header1, + ): + ; + + + /** + * Operation testInlineAdditionalProperties + * + * test inline additionalProperties + * @param array $requestBody + * @return + */ + public function testInlineAdditionalProperties( + array $requestBody, + ): + ; + + + /** + * Operation testInlineFreeformAdditionalProperties + * + * test inline free-form additionalProperties + * @param \app\Models\TestInlineFreeformAdditionalPropertiesRequest $testInlineFreeformAdditionalPropertiesRequest + * @return + */ + public function testInlineFreeformAdditionalProperties( + \app\Models\TestInlineFreeformAdditionalPropertiesRequest $testInlineFreeformAdditionalPropertiesRequest, + ): + ; + + + /** + * Operation testJsonFormData + * + * test json serialization of form data + * @param string $param + * @param string $param2 + * @return + */ + public function testJsonFormData( + string $param, + string $param2, + ): + ; + + + /** + * Operation testNullable + * + * test nullable parent property + * @param \app\Models\ChildWithNullable $childWithNullable + * @return + */ + public function testNullable( + \app\Models\ChildWithNullable $childWithNullable, + ): + ; + + + /** + * Operation fakeOuterBooleanSerialize + * @param null | bool $body + * @return bool + */ + public function fakeOuterBooleanSerialize( + ?bool $body, + ): + bool + ; + + + /** + * Operation fakeOuterCompositeSerialize + * @param null | \app\Models\OuterComposite $outerComposite + * @return \app\Models\OuterComposite + */ + public function fakeOuterCompositeSerialize( + ?\app\Models\OuterComposite $outerComposite, + ): + \app\Models\OuterComposite + ; + + + /** + * Operation fakeOuterNumberSerialize + * @param null | float $body + * @return float + */ + public function fakeOuterNumberSerialize( + ?float $body, + ): + float + ; + + + /** + * Operation fakeOuterStringSerialize + * @param null | string $body + * @return string + */ + public function fakeOuterStringSerialize( + ?string $body, + ): + string + ; + + + /** + * Operation fakePropertyEnumIntegerSerialize + * @param \app\Models\OuterObjectWithEnumProperty $outerObjectWithEnumProperty + * @return \app\Models\OuterObjectWithEnumProperty + */ + public function fakePropertyEnumIntegerSerialize( + \app\Models\OuterObjectWithEnumProperty $outerObjectWithEnumProperty, + ): + \app\Models\OuterObjectWithEnumProperty + ; + + + /** + * Operation testStringMapReference + * + * test referenced string map + * @param array $requestBody + * @return + */ + public function testStringMapReference( + array $requestBody, + ): + ; + + + /** + * Operation testQueryParameterCollectionFormat + * @param string[] $pipe + * @param string[] $ioutil + * @param string[] $http + * @param string[] $url + * @param string[] $context + * @param string $allowEmpty + * @param null | array $language + * @return + */ + public function testQueryParameterCollectionFormat( + array $pipe, + array $ioutil, + array $http, + array $url, + array $context, + string $allowEmpty, + ?array $language, + ): + ; + +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/PetController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/PetController.php new file mode 100644 index 000000000000..d8ba0ed2b6c7 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/PetController.php @@ -0,0 +1,163 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +namespace app.Http.Controllers; + + +interface PetController { + + + /** + * Operation uploadFileWithRequiredFile + * + * uploads an image (required) + * @param int $petId + * @param \SplFileObject $requiredFile + * @param null | string $additionalMetadata + * @return \app\Models\ApiResponse + */ + public function uploadFileWithRequiredFile( + int $petId, + \SplFileObject $requiredFile, + ?string $additionalMetadata, + ): + \app\Models\ApiResponse + ; + + + /** + * Operation addPet + * + * Add a new pet to the store + * @param \app\Models\Pet $pet + * @return | + */ + public function addPet( + \app\Models\Pet $pet, + ): + ; + + + /** + * Operation updatePet + * + * Update an existing pet + * @param \app\Models\Pet $pet + * @return | | | + */ + public function updatePet( + \app\Models\Pet $pet, + ): + ; + + + /** + * Operation findPetsByStatus + * + * Finds Pets by status + * @param string[] $status + * @return \app\Models\Pet[] | + */ + public function findPetsByStatus( + array $status, + ): + array | + ; + + + /** + * Operation findPetsByTags + * + * Finds Pets by tags + * @param string[] $tags + * @return \app\Models\Pet[] | + * @deprecated + */ + public function findPetsByTags( + array $tags, + ): + array | + ; + + + /** + * Operation deletePet + * + * Deletes a pet + * @param int $petId + * @param null | string $apiKey + * @return | + */ + public function deletePet( + int $petId, + ?string $apiKey, + ): + ; + + + /** + * Operation getPetById + * + * Find pet by ID + * @param int $petId + * @return \app\Models\Pet | | + */ + public function getPetById( + int $petId, + ): + \app\Models\Pet | + ; + + + /** + * Operation updatePetWithForm + * + * Updates a pet in the store with form data + * @param int $petId + * @param null | string $name + * @param null | string $status + * @return | + */ + public function updatePetWithForm( + int $petId, + ?string $name, + ?string $status, + ): + ; + + + /** + * Operation uploadFile + * + * uploads an image + * @param int $petId + * @param null | string $additionalMetadata + * @param null | \SplFileObject $file + * @return \app\Models\ApiResponse + */ + public function uploadFile( + int $petId, + ?string $additionalMetadata, + ?\SplFileObject $file, + ): + \app\Models\ApiResponse + ; + +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/StoreController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/StoreController.php new file mode 100644 index 000000000000..4d3582670b86 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/StoreController.php @@ -0,0 +1,79 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +namespace app.Http.Controllers; + + +interface StoreController { + + + /** + * Operation getInventory + * + * Returns pet inventories by status + * @return array + */ + public function getInventory( + ): + array + ; + + + /** + * Operation placeOrder + * + * Place an order for a pet + * @param \app\Models\Order $order + * @return \app\Models\Order | + */ + public function placeOrder( + \app\Models\Order $order, + ): + \app\Models\Order | + ; + + + /** + * Operation deleteOrder + * + * Delete purchase order by ID + * @param string $orderId + * @return | + */ + public function deleteOrder( + string $orderId, + ): + ; + + + /** + * Operation getOrderById + * + * Find purchase order by ID + * @param int $orderId + * @return \app\Models\Order | | + */ + public function getOrderById( + int $orderId, + ): + \app\Models\Order | + ; + +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/UserController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/UserController.php new file mode 100644 index 000000000000..c5d3e41b21e8 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/UserController.php @@ -0,0 +1,134 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +namespace app.Http.Controllers; + + +interface UserController { + + + /** + * Operation createUser + * + * Create user + * @param \app\Models\User $user + * @return + */ + public function createUser( + \app\Models\User $user, + ): + ; + + + /** + * Operation createUsersWithArrayInput + * + * Creates list of users with given input array + * @param \app\Models\User[] $user + * @return + */ + public function createUsersWithArrayInput( + array $user, + ): + ; + + + /** + * Operation createUsersWithListInput + * + * Creates list of users with given input array + * @param \app\Models\User[] $user + * @return + */ + public function createUsersWithListInput( + array $user, + ): + ; + + + /** + * Operation loginUser + * + * Logs user into the system + * @param string $username + * @param string $password + * @return string | + */ + public function loginUser( + string $username, + string $password, + ): + string | + ; + + + /** + * Operation logoutUser + * + * Logs out current logged in user session + * @return + */ + public function logoutUser( + ): + ; + + + /** + * Operation deleteUser + * + * Delete user + * @param string $username + * @return | + */ + public function deleteUser( + string $username, + ): + ; + + + /** + * Operation getUserByName + * + * Get user by user name + * @param string $username + * @return \app\Models\User | | + */ + public function getUserByName( + string $username, + ): + \app\Models\User | + ; + + + /** + * Operation updateUser + * + * Updated user + * @param string $username + * @param \app\Models\User $user + * @return | + */ + public function updateUser( + string $username, + \app\Models\User $user, + ): + ; + +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Kernel.php b/samples/server/petstore/php-laravel/lib/app/Http/Kernel.php new file mode 100644 index 000000000000..c3640f30b87d --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Kernel.php @@ -0,0 +1,66 @@ + [ + \App\Http\Middleware\EncryptCookies::class, + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + \Illuminate\Session\Middleware\StartSession::class, + // \Illuminate\Session\Middleware\AuthenticateSession::class, + \Illuminate\View\Middleware\ShareErrorsFromSession::class, + \App\Http\Middleware\VerifyCsrfToken::class, + \Illuminate\Routing\Middleware\SubstituteBindings::class, + ], + + 'api' => [ + 'throttle:60,1', + \Illuminate\Routing\Middleware\SubstituteBindings::class, + ], + ]; + + /** + * The application's route middleware. + * + * These middleware may be assigned to groups or used individually. + * + * @var array + */ + protected $routeMiddleware = [ + 'auth' => \App\Http\Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, + 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, + 'can' => \Illuminate\Auth\Middleware\Authorize::class, + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, + 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, + ]; +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Middleware/Authenticate.php b/samples/server/petstore/php-laravel/lib/app/Http/Middleware/Authenticate.php new file mode 100644 index 000000000000..704089a7fe75 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Middleware/Authenticate.php @@ -0,0 +1,21 @@ +expectsJson()) { + return route('login'); + } + } +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Middleware/CheckForMaintenanceMode.php b/samples/server/petstore/php-laravel/lib/app/Http/Middleware/CheckForMaintenanceMode.php new file mode 100644 index 000000000000..35b9824baefb --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Middleware/CheckForMaintenanceMode.php @@ -0,0 +1,17 @@ +check()) { + return redirect(RouteServiceProvider::HOME); + } + + return $next($request); + } +} diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Middleware/TrimStrings.php b/samples/server/petstore/php-laravel/lib/app/Http/Middleware/TrimStrings.php new file mode 100644 index 000000000000..5a50e7b5c8bd --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Http/Middleware/TrimStrings.php @@ -0,0 +1,18 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * AdditionalPropertiesClass + */ +namespace app\Models; + +/** + * AdditionalPropertiesClass + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class AdditionalPropertiesClass +{ + /** + * + * + * @param array $mapProperty + * + * + * @param array> $mapOfMapProperty + */ + + public function __construct( + public array $mapProperty, + public array $mapOfMapProperty, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/AllOfWithSingleRef.php b/samples/server/petstore/php-laravel/lib/app/Models/AllOfWithSingleRef.php new file mode 100644 index 000000000000..eb161095e729 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/AllOfWithSingleRef.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * AllOfWithSingleRef + */ +namespace app\Models; + +/** + * AllOfWithSingleRef + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class AllOfWithSingleRef +{ + /** + * + * + * @param string $username + * + * + * @param \app\Models\SingleRefType $singleRefType + */ + + public function __construct( + public string $username = "", + public \app\Models\SingleRefType $singleRefType, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Animal.php b/samples/server/petstore/php-laravel/lib/app/Models/Animal.php new file mode 100644 index 000000000000..c37a5d0b72b8 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Animal.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Animal + */ +namespace app\Models; + +/** + * Animal + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Animal +{ + /** + * + * + * @param string $className + * + * + * @param string $color + */ + + public function __construct( + public string $className = "", + public string $color = 'red', + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ApiResponse.php b/samples/server/petstore/php-laravel/lib/app/Models/ApiResponse.php new file mode 100644 index 000000000000..2d66d2d31be2 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ApiResponse.php @@ -0,0 +1,53 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ApiResponse + */ +namespace app\Models; + +/** + * ApiResponse + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ApiResponse +{ + /** + * + * + * @param int $code + * + * + * @param string $type + * + * + * @param string $message + */ + + public function __construct( + public int $code = 0, + public string $type = "", + public string $message = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ArrayOfArrayOfNumberOnly.php b/samples/server/petstore/php-laravel/lib/app/Models/ArrayOfArrayOfNumberOnly.php new file mode 100644 index 000000000000..5be989ee6f14 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ArrayOfArrayOfNumberOnly.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ArrayOfArrayOfNumberOnly + */ +namespace app\Models; + +/** + * ArrayOfArrayOfNumberOnly + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ArrayOfArrayOfNumberOnly +{ + /** + * + * + * @param float[][] $arrayArrayNumber + */ + + public function __construct( + public array $arrayArrayNumber, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ArrayOfNumberOnly.php b/samples/server/petstore/php-laravel/lib/app/Models/ArrayOfNumberOnly.php new file mode 100644 index 000000000000..305918097abc --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ArrayOfNumberOnly.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ArrayOfNumberOnly + */ +namespace app\Models; + +/** + * ArrayOfNumberOnly + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ArrayOfNumberOnly +{ + /** + * + * + * @param float[] $arrayNumber + */ + + public function __construct( + public array $arrayNumber, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ArrayTest.php b/samples/server/petstore/php-laravel/lib/app/Models/ArrayTest.php new file mode 100644 index 000000000000..1867b4fef303 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ArrayTest.php @@ -0,0 +1,53 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ArrayTest + */ +namespace app\Models; + +/** + * ArrayTest + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ArrayTest +{ + /** + * + * + * @param string[] $arrayOfString + * + * + * @param int[][] $arrayArrayOfInteger + * + * + * @param \app\Models\ReadOnlyFirst[][] $arrayArrayOfModel + */ + + public function __construct( + public array $arrayOfString, + public array $arrayArrayOfInteger, + public array $arrayArrayOfModel, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Capitalization.php b/samples/server/petstore/php-laravel/lib/app/Models/Capitalization.php new file mode 100644 index 000000000000..da7cd9f91564 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Capitalization.php @@ -0,0 +1,65 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Capitalization + */ +namespace app\Models; + +/** + * Capitalization + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Capitalization +{ + /** + * + * + * @param string $smallCamel + * + * + * @param string $capitalCamel + * + * + * @param string $smallSnake + * + * + * @param string $capitalSnake + * + * + * @param string $sCAETHFlowPoints + * + * Name of the pet + * @param string $aTTNAME + */ + + public function __construct( + public string $smallCamel = "", + public string $capitalCamel = "", + public string $smallSnake = "", + public string $capitalSnake = "", + public string $sCAETHFlowPoints = "", + public string $aTTNAME = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Cat.php b/samples/server/petstore/php-laravel/lib/app/Models/Cat.php new file mode 100644 index 000000000000..61ec7f4606fa --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Cat.php @@ -0,0 +1,53 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Cat + */ +namespace app\Models; + +/** + * Cat + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Cat +{ + /** + * + * + * @param string $className + * + * + * @param string $color + * + * + * @param bool $declawed + */ + + public function __construct( + public string $className = "", + public string $color = 'red', + public bool $declawed = false, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Category.php b/samples/server/petstore/php-laravel/lib/app/Models/Category.php new file mode 100644 index 000000000000..88f734830771 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Category.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Category + */ +namespace app\Models; + +/** + * Category + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Category +{ + /** + * + * + * @param int $id + * + * + * @param string $name + */ + + public function __construct( + public int $id = 0, + public string $name = 'default-name', + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ChildWithNullable.php b/samples/server/petstore/php-laravel/lib/app/Models/ChildWithNullable.php new file mode 100644 index 000000000000..b297965dd597 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ChildWithNullable.php @@ -0,0 +1,53 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ChildWithNullable + */ +namespace app\Models; + +/** + * ChildWithNullable + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ChildWithNullable +{ + /** + * + * + * @param string $type + * + * + * @param null | string $nullableProperty + * + * + * @param string $otherProperty + */ + + public function __construct( + public string $type = "", + public string $otherProperty = "", + public ?string $nullableProperty = null, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ClassModel.php b/samples/server/petstore/php-laravel/lib/app/Models/ClassModel.php new file mode 100644 index 000000000000..88f9d4990816 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ClassModel.php @@ -0,0 +1,46 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ClassModel + */ +namespace app\Models; + +/** + * ClassModel + * @description Model for testing model with \"_class\" property + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ClassModel +{ + /** + * + * + * @param string $class + */ + + public function __construct( + public string $class = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Client.php b/samples/server/petstore/php-laravel/lib/app/Models/Client.php new file mode 100644 index 000000000000..25f10aad503b --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Client.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Client + */ +namespace app\Models; + +/** + * Client + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Client +{ + /** + * + * + * @param string $client + */ + + public function __construct( + public string $client = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/DeprecatedObject.php b/samples/server/petstore/php-laravel/lib/app/Models/DeprecatedObject.php new file mode 100644 index 000000000000..28f3eb70e5ea --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/DeprecatedObject.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * DeprecatedObject + */ +namespace app\Models; + +/** + * DeprecatedObject + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class DeprecatedObject +{ + /** + * + * + * @param string $name + */ + + public function __construct( + public string $name = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Dog.php b/samples/server/petstore/php-laravel/lib/app/Models/Dog.php new file mode 100644 index 000000000000..8225b4967acb --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Dog.php @@ -0,0 +1,53 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Dog + */ +namespace app\Models; + +/** + * Dog + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Dog +{ + /** + * + * + * @param string $className + * + * + * @param string $color + * + * + * @param string $breed + */ + + public function __construct( + public string $className = "", + public string $color = 'red', + public string $breed = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/EnumArrays.php b/samples/server/petstore/php-laravel/lib/app/Models/EnumArrays.php new file mode 100644 index 000000000000..e581857d676f --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/EnumArrays.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * EnumArrays + */ +namespace app\Models; + +/** + * EnumArrays + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class EnumArrays +{ + /** + * + * + * @param string $justSymbol + * + * + * @param string[] $arrayEnum + */ + + public function __construct( + public string $justSymbol = "", + public array $arrayEnum, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/EnumClass.php b/samples/server/petstore/php-laravel/lib/app/Models/EnumClass.php new file mode 100644 index 000000000000..411d0c1b1b8e --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/EnumClass.php @@ -0,0 +1,34 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * EnumClass + */ +namespace app\Models; + +/** + * EnumClass + */ +enum EnumClass: string +{ + case ABC = '_abc'; + case EFG = '-efg'; + case XYZ = '(xyz)'; +} diff --git a/samples/server/petstore/php-laravel/lib/app/Models/EnumTest.php b/samples/server/petstore/php-laravel/lib/app/Models/EnumTest.php new file mode 100644 index 000000000000..1c99d0836c6e --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/EnumTest.php @@ -0,0 +1,73 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * EnumTest + */ +namespace app\Models; + +/** + * EnumTest + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class EnumTest +{ + /** + * + * + * @param string $enumString + * + * + * @param string $enumStringRequired + * + * + * @param int $enumInteger + * + * + * @param float $enumNumber + * + * + * @param null | string $outerEnum + * + * + * @param int $outerEnumInteger + * + * + * @param string $outerEnumDefaultValue + * + * + * @param int $outerEnumIntegerDefaultValue + */ + + public function __construct( + public string $enumString = "", + public string $enumStringRequired = "", + public int $enumInteger = 0, + public float $enumNumber = 0, + public int $outerEnumInteger = \app\Models\OuterEnumInteger::NUMBER_0, + public string $outerEnumDefaultValue = \app\Models\OuterEnumDefaultValue::PLACED, + public int $outerEnumIntegerDefaultValue = \app\Models\OuterEnumIntegerDefaultValue::NUMBER_0, + public ?string $outerEnum = null, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/FakeBigDecimalMap200Response.php b/samples/server/petstore/php-laravel/lib/app/Models/FakeBigDecimalMap200Response.php new file mode 100644 index 000000000000..572f7734bf65 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/FakeBigDecimalMap200Response.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * FakeBigDecimalMap200Response + */ +namespace app\Models; + +/** + * FakeBigDecimalMap200Response + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class FakeBigDecimalMap200Response +{ + /** + * + * + * @param float $someId + * + * + * @param array $someMap + */ + + public function __construct( + public float $someId = 0, + public array $someMap, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/File.php b/samples/server/petstore/php-laravel/lib/app/Models/File.php new file mode 100644 index 000000000000..78e6f5e0584f --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/File.php @@ -0,0 +1,46 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * File + */ +namespace app\Models; + +/** + * File + * @description Must be named `File` for test. + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class File +{ + /** + * + * Test capitalization + * @param string $sourceURI + */ + + public function __construct( + public string $sourceURI = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/FileSchemaTestClass.php b/samples/server/petstore/php-laravel/lib/app/Models/FileSchemaTestClass.php new file mode 100644 index 000000000000..b51bf99a885e --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/FileSchemaTestClass.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * FileSchemaTestClass + */ +namespace app\Models; + +/** + * FileSchemaTestClass + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class FileSchemaTestClass +{ + /** + * + * + * @param \app\Models\File $file + * + * + * @param \app\Models\File[] $files + */ + + public function __construct( + public \app\Models\File $file, + public array $files, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Foo.php b/samples/server/petstore/php-laravel/lib/app/Models/Foo.php new file mode 100644 index 000000000000..48d18b30b24f --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Foo.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Foo + */ +namespace app\Models; + +/** + * Foo + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Foo +{ + /** + * + * + * @param string $bar + */ + + public function __construct( + public string $bar = 'bar', + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/FooGetDefaultResponse.php b/samples/server/petstore/php-laravel/lib/app/Models/FooGetDefaultResponse.php new file mode 100644 index 000000000000..51a361fe6886 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/FooGetDefaultResponse.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * FooGetDefaultResponse + */ +namespace app\Models; + +/** + * FooGetDefaultResponse + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class FooGetDefaultResponse +{ + /** + * + * + * @param \app\Models\Foo $string + */ + + public function __construct( + public \app\Models\Foo $string, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/FormatTest.php b/samples/server/petstore/php-laravel/lib/app/Models/FormatTest.php new file mode 100644 index 000000000000..36bdcc53cb73 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/FormatTest.php @@ -0,0 +1,105 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * FormatTest + */ +namespace app\Models; + +/** + * FormatTest + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class FormatTest +{ + /** + * + * + * @param int $integer + * + * + * @param int $int32 + * + * + * @param int $int64 + * + * + * @param float $number + * + * + * @param float $float + * + * + * @param float $double + * + * + * @param float $decimal + * + * + * @param string $string + * + * + * @param string $byte + * + * + * @param \SplFileObject $binary + * + * + * @param \DateTime $date + * + * + * @param \DateTime $dateTime + * + * + * @param string $uuid + * + * + * @param string $password + * + * A string that is a 10 digit number. Can have leading zeros. + * @param string $patternWithDigits + * + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + * @param string $patternWithDigitsAndDelimiter + */ + + public function __construct( + public int $integer = 0, + public int $int32 = 0, + public int $int64 = 0, + public float $number = 0, + public float $float = 0, + public float $double = 0, + public float $decimal = "", + public string $string = "", + public string $byte = "", + public \SplFileObject $binary, + public \DateTime $date, + public \DateTime $dateTime, + public string $uuid = "", + public string $password = "", + public string $patternWithDigits = "", + public string $patternWithDigitsAndDelimiter = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/HasOnlyReadOnly.php b/samples/server/petstore/php-laravel/lib/app/Models/HasOnlyReadOnly.php new file mode 100644 index 000000000000..6e799d67f714 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/HasOnlyReadOnly.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * HasOnlyReadOnly + */ +namespace app\Models; + +/** + * HasOnlyReadOnly + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class HasOnlyReadOnly +{ + /** + * + * + * @param string $bar + * + * + * @param string $foo + */ + + public function __construct( + public string $bar = "", + public string $foo = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/HealthCheckResult.php b/samples/server/petstore/php-laravel/lib/app/Models/HealthCheckResult.php new file mode 100644 index 000000000000..905245c05d86 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/HealthCheckResult.php @@ -0,0 +1,46 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * HealthCheckResult + */ +namespace app\Models; + +/** + * HealthCheckResult + * @description Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class HealthCheckResult +{ + /** + * + * + * @param null | string $nullableMessage + */ + + public function __construct( + public ?string $nullableMessage = null, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/MapTest.php b/samples/server/petstore/php-laravel/lib/app/Models/MapTest.php new file mode 100644 index 000000000000..360e52092aa5 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/MapTest.php @@ -0,0 +1,57 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * MapTest + */ +namespace app\Models; + +/** + * MapTest + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class MapTest +{ + /** + * + * + * @param array> $mapMapOfString + * + * + * @param array $mapOfEnumString + * + * + * @param array $directMap + * + * + * @param array $indirectMap + */ + + public function __construct( + public array $mapMapOfString, + public array $mapOfEnumString, + public array $directMap, + public array $indirectMap, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/MixedPropertiesAndAdditionalPropertiesClass.php b/samples/server/petstore/php-laravel/lib/app/Models/MixedPropertiesAndAdditionalPropertiesClass.php new file mode 100644 index 000000000000..a93173fc2f3d --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/MixedPropertiesAndAdditionalPropertiesClass.php @@ -0,0 +1,53 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +namespace app\Models; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class MixedPropertiesAndAdditionalPropertiesClass +{ + /** + * + * + * @param string $uuid + * + * + * @param \DateTime $dateTime + * + * + * @param array $map + */ + + public function __construct( + public string $uuid = "", + public \DateTime $dateTime, + public array $map, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Model200Response.php b/samples/server/petstore/php-laravel/lib/app/Models/Model200Response.php new file mode 100644 index 000000000000..10fbdcbf30e0 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Model200Response.php @@ -0,0 +1,50 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Model200Response + */ +namespace app\Models; + +/** + * Model200Response + * @description Model for testing model name starting with number + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Model200Response +{ + /** + * + * + * @param int $name + * + * + * @param string $class + */ + + public function __construct( + public int $name = 0, + public string $class = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ModelList.php b/samples/server/petstore/php-laravel/lib/app/Models/ModelList.php new file mode 100644 index 000000000000..c9be6d5e9fa7 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ModelList.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ModelList + */ +namespace app\Models; + +/** + * ModelList + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ModelList +{ + /** + * + * + * @param string $_123list + */ + + public function __construct( + public string $_123list = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ModelReturn.php b/samples/server/petstore/php-laravel/lib/app/Models/ModelReturn.php new file mode 100644 index 000000000000..459cecb213f5 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ModelReturn.php @@ -0,0 +1,46 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ModelReturn + */ +namespace app\Models; + +/** + * ModelReturn + * @description Model for testing reserved words + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ModelReturn +{ + /** + * + * + * @param int $return + */ + + public function __construct( + public int $return = 0, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Name.php b/samples/server/petstore/php-laravel/lib/app/Models/Name.php new file mode 100644 index 000000000000..3c14c98a81f3 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Name.php @@ -0,0 +1,58 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Name + */ +namespace app\Models; + +/** + * Name + * @description Model for testing model name same as property name + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Name +{ + /** + * + * + * @param int $name + * + * + * @param int $snakeCase + * + * + * @param string $property + * + * + * @param int $_123number + */ + + public function __construct( + public int $name = 0, + public int $snakeCase = 0, + public string $property = "", + public int $_123number = 0, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/NullableClass.php b/samples/server/petstore/php-laravel/lib/app/Models/NullableClass.php new file mode 100644 index 000000000000..22db724f3d56 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/NullableClass.php @@ -0,0 +1,89 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * NullableClass + */ +namespace app\Models; + +/** + * NullableClass + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class NullableClass +{ + /** + * + * + * @param null | int $integerProp + * + * + * @param null | float $numberProp + * + * + * @param null | bool $booleanProp + * + * + * @param null | string $stringProp + * + * + * @param null | \DateTime $dateProp + * + * + * @param null | \DateTime $datetimeProp + * + * + * @param null | object[] $arrayNullableProp + * + * + * @param null | object[] $arrayAndItemsNullableProp + * + * + * @param object[] $arrayItemsNullable + * + * + * @param null | array $objectNullableProp + * + * + * @param null | array $objectAndItemsNullableProp + * + * + * @param array $objectItemsNullable + */ + + public function __construct( + public array $arrayItemsNullable, + public array $objectItemsNullable, + public ?int $integerProp = null, + public ?float $numberProp = null, + public ?bool $booleanProp = null, + public ?string $stringProp = null, + public ?\DateTime $dateProp = null, + public ?\DateTime $datetimeProp = null, + public ?array $arrayNullableProp = null, + public ?array $arrayAndItemsNullableProp = null, + public ?array $objectNullableProp = null, + public ?array $objectAndItemsNullableProp = null, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/NumberOnly.php b/samples/server/petstore/php-laravel/lib/app/Models/NumberOnly.php new file mode 100644 index 000000000000..8c0895cce37c --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/NumberOnly.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * NumberOnly + */ +namespace app\Models; + +/** + * NumberOnly + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class NumberOnly +{ + /** + * + * + * @param float $justNumber + */ + + public function __construct( + public float $justNumber = 0, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ObjectWithDeprecatedFields.php b/samples/server/petstore/php-laravel/lib/app/Models/ObjectWithDeprecatedFields.php new file mode 100644 index 000000000000..f30cabc0b14c --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ObjectWithDeprecatedFields.php @@ -0,0 +1,60 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ObjectWithDeprecatedFields + */ +namespace app\Models; + +/** + * ObjectWithDeprecatedFields + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ObjectWithDeprecatedFields +{ + /** + * + * + * @param string $uuid + * + * + * @deprecated + * @param float $id + * + * + * @deprecated + * @param \app\Models\DeprecatedObject $deprecatedRef + * + * + * @deprecated + * @param string[] $bars + */ + + public function __construct( + public string $uuid = "", + public float $id = 0, + public \app\Models\DeprecatedObject $deprecatedRef, + public array $bars, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Order.php b/samples/server/petstore/php-laravel/lib/app/Models/Order.php new file mode 100644 index 000000000000..df009c241a52 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Order.php @@ -0,0 +1,65 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Order + */ +namespace app\Models; + +/** + * Order + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Order +{ + /** + * + * + * @param int $id + * + * + * @param int $petId + * + * + * @param int $quantity + * + * + * @param \DateTime $shipDate + * + * Order Status + * @param string $status + * + * + * @param bool $complete + */ + + public function __construct( + public int $id = 0, + public int $petId = 0, + public int $quantity = 0, + public \DateTime $shipDate, + public string $status = "", + public bool $complete = false, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/OuterComposite.php b/samples/server/petstore/php-laravel/lib/app/Models/OuterComposite.php new file mode 100644 index 000000000000..35596a0777d8 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/OuterComposite.php @@ -0,0 +1,53 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * OuterComposite + */ +namespace app\Models; + +/** + * OuterComposite + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class OuterComposite +{ + /** + * + * + * @param float $myNumber + * + * + * @param string $myString + * + * + * @param bool $myBoolean + */ + + public function __construct( + public float $myNumber = 0, + public string $myString = "", + public bool $myBoolean = false, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/OuterEnum.php b/samples/server/petstore/php-laravel/lib/app/Models/OuterEnum.php new file mode 100644 index 000000000000..c8032d411eb8 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/OuterEnum.php @@ -0,0 +1,34 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * OuterEnum + */ +namespace app\Models; + +/** + * OuterEnum + */ +enum OuterEnum: string +{ + case PLACED = 'placed'; + case APPROVED = 'approved'; + case DELIVERED = 'delivered'; +} diff --git a/samples/server/petstore/php-laravel/lib/app/Models/OuterEnumDefaultValue.php b/samples/server/petstore/php-laravel/lib/app/Models/OuterEnumDefaultValue.php new file mode 100644 index 000000000000..829e393df5b2 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/OuterEnumDefaultValue.php @@ -0,0 +1,34 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * OuterEnumDefaultValue + */ +namespace app\Models; + +/** + * OuterEnumDefaultValue + */ +enum OuterEnumDefaultValue: string +{ + case PLACED = 'placed'; + case APPROVED = 'approved'; + case DELIVERED = 'delivered'; +} diff --git a/samples/server/petstore/php-laravel/lib/app/Models/OuterEnumInteger.php b/samples/server/petstore/php-laravel/lib/app/Models/OuterEnumInteger.php new file mode 100644 index 000000000000..b80eceed4892 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/OuterEnumInteger.php @@ -0,0 +1,34 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * OuterEnumInteger + */ +namespace app\Models; + +/** + * OuterEnumInteger + */ +enum OuterEnumInteger: int +{ + case NUMBER_0 = 0; + case NUMBER_1 = 1; + case NUMBER_2 = 2; +} diff --git a/samples/server/petstore/php-laravel/lib/app/Models/OuterEnumIntegerDefaultValue.php b/samples/server/petstore/php-laravel/lib/app/Models/OuterEnumIntegerDefaultValue.php new file mode 100644 index 000000000000..1c10fbe2c80c --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/OuterEnumIntegerDefaultValue.php @@ -0,0 +1,34 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * OuterEnumIntegerDefaultValue + */ +namespace app\Models; + +/** + * OuterEnumIntegerDefaultValue + */ +enum OuterEnumIntegerDefaultValue: int +{ + case NUMBER_0 = 0; + case NUMBER_1 = 1; + case NUMBER_2 = 2; +} diff --git a/samples/server/petstore/php-laravel/lib/app/Models/OuterObjectWithEnumProperty.php b/samples/server/petstore/php-laravel/lib/app/Models/OuterObjectWithEnumProperty.php new file mode 100644 index 000000000000..d47a8700bd62 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/OuterObjectWithEnumProperty.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * OuterObjectWithEnumProperty + */ +namespace app\Models; + +/** + * OuterObjectWithEnumProperty + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class OuterObjectWithEnumProperty +{ + /** + * + * + * @param int $value + */ + + public function __construct( + public int $value = \app\Models\OuterEnumInteger::NUMBER_0, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ParentWithNullable.php b/samples/server/petstore/php-laravel/lib/app/Models/ParentWithNullable.php new file mode 100644 index 000000000000..25e7700232bf --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ParentWithNullable.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ParentWithNullable + */ +namespace app\Models; + +/** + * ParentWithNullable + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ParentWithNullable +{ + /** + * + * + * @param string $type + * + * + * @param null | string $nullableProperty + */ + + public function __construct( + public string $type = "", + public ?string $nullableProperty = null, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Pet.php b/samples/server/petstore/php-laravel/lib/app/Models/Pet.php new file mode 100644 index 000000000000..fdb5d5249378 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Pet.php @@ -0,0 +1,65 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Pet + */ +namespace app\Models; + +/** + * Pet + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Pet +{ + /** + * + * + * @param int $id + * + * + * @param \app\Models\Category $category + * + * + * @param string $name + * + * + * @param string[] $photoUrls + * + * + * @param \app\Models\Tag[] $tags + * + * pet status in the store + * @param string $status + */ + + public function __construct( + public int $id = 0, + public \app\Models\Category $category, + public string $name = "", + public array $photoUrls, + public array $tags, + public string $status = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/ReadOnlyFirst.php b/samples/server/petstore/php-laravel/lib/app/Models/ReadOnlyFirst.php new file mode 100644 index 000000000000..18f7143bc0c1 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/ReadOnlyFirst.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * ReadOnlyFirst + */ +namespace app\Models; + +/** + * ReadOnlyFirst + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class ReadOnlyFirst +{ + /** + * + * + * @param string $bar + * + * + * @param string $baz + */ + + public function __construct( + public string $bar = "", + public string $baz = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/SingleRefType.php b/samples/server/petstore/php-laravel/lib/app/Models/SingleRefType.php new file mode 100644 index 000000000000..5601d94283b2 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/SingleRefType.php @@ -0,0 +1,33 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * SingleRefType + */ +namespace app\Models; + +/** + * SingleRefType + */ +enum SingleRefType: string +{ + case ADMIN = 'admin'; + case USER = 'user'; +} diff --git a/samples/server/petstore/php-laravel/lib/app/Models/SpecialModelName.php b/samples/server/petstore/php-laravel/lib/app/Models/SpecialModelName.php new file mode 100644 index 000000000000..d44b316ca63d --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/SpecialModelName.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * SpecialModelName + */ +namespace app\Models; + +/** + * SpecialModelName + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class SpecialModelName +{ + /** + * + * + * @param int $specialPropertyName + */ + + public function __construct( + public int $specialPropertyName = 0, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/Tag.php b/samples/server/petstore/php-laravel/lib/app/Models/Tag.php new file mode 100644 index 000000000000..e55e9920d238 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/Tag.php @@ -0,0 +1,49 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * Tag + */ +namespace app\Models; + +/** + * Tag + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class Tag +{ + /** + * + * + * @param int $id + * + * + * @param string $name + */ + + public function __construct( + public int $id = 0, + public string $name = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/TestInlineFreeformAdditionalPropertiesRequest.php b/samples/server/petstore/php-laravel/lib/app/Models/TestInlineFreeformAdditionalPropertiesRequest.php new file mode 100644 index 000000000000..6b3092269ee1 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/TestInlineFreeformAdditionalPropertiesRequest.php @@ -0,0 +1,45 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * TestInlineFreeformAdditionalPropertiesRequest + */ +namespace app\Models; + +/** + * TestInlineFreeformAdditionalPropertiesRequest + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class TestInlineFreeformAdditionalPropertiesRequest +{ + /** + * + * + * @param string $someProperty + */ + + public function __construct( + public string $someProperty = "", + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Models/User.php b/samples/server/petstore/php-laravel/lib/app/Models/User.php new file mode 100644 index 000000000000..c335c3e3e6c0 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/User.php @@ -0,0 +1,73 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +/** + * User + */ +namespace app\Models; + +/** + * User + */ +use Crell\Serde\Renaming\Cases; +use Crell\Serde\Attributes as Serde; + +#[Serde\ClassSettings(renameWith: Cases::snake_case)] +class User +{ + /** + * + * + * @param int $id + * + * + * @param string $username + * + * + * @param string $firstName + * + * + * @param string $lastName + * + * + * @param string $email + * + * + * @param string $password + * + * + * @param string $phone + * + * User Status + * @param int $userStatus + */ + + public function __construct( + public int $id = 0, + public string $username = "", + public string $firstName = "", + public string $lastName = "", + public string $email = "", + public string $password = "", + public string $phone = "", + public int $userStatus = 0, + ) {} +} + diff --git a/samples/server/petstore/php-laravel/lib/app/Providers/AppServiceProvider.php b/samples/server/petstore/php-laravel/lib/app/Providers/AppServiceProvider.php new file mode 100644 index 000000000000..ee8ca5bcd8f7 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Providers/AppServiceProvider.php @@ -0,0 +1,28 @@ + 'App\Policies\ModelPolicy', + ]; + + /** + * Register any authentication / authorization services. + * + * @return void + */ + public function boot() + { + $this->registerPolicies(); + + // + } +} diff --git a/samples/server/petstore/php-laravel/lib/app/Providers/BroadcastServiceProvider.php b/samples/server/petstore/php-laravel/lib/app/Providers/BroadcastServiceProvider.php new file mode 100644 index 000000000000..395c518bc47b --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Providers/BroadcastServiceProvider.php @@ -0,0 +1,21 @@ + [ + SendEmailVerificationNotification::class, + ], + ]; + + /** + * Register any events for your application. + * + * @return void + */ + public function boot() + { + parent::boot(); + + // + } +} diff --git a/samples/server/petstore/php-laravel/lib/app/Providers/RouteServiceProvider.php b/samples/server/petstore/php-laravel/lib/app/Providers/RouteServiceProvider.php new file mode 100644 index 000000000000..540d17b43083 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Providers/RouteServiceProvider.php @@ -0,0 +1,80 @@ +mapApiRoutes(); + + $this->mapWebRoutes(); + + // + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + * + * @return void + */ + protected function mapWebRoutes() + { + Route::middleware('web') + ->namespace($this->namespace) + ->group(base_path('routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + * + * @return void + */ + protected function mapApiRoutes() + { + Route::prefix('api') + ->middleware('api') + ->namespace($this->namespace) + ->group(base_path('routes/api.php')); + } +} diff --git a/samples/server/petstore/php-laravel/lib/app/RouteServiceProvider.php b/samples/server/petstore/php-laravel/lib/app/RouteServiceProvider.php new file mode 100644 index 000000000000..e79dab7fea8f --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/RouteServiceProvider.php @@ -0,0 +1,39 @@ + 'datetime', + ]; +} diff --git a/samples/server/petstore/php-laravel/lib/artisan b/samples/server/petstore/php-laravel/lib/artisan new file mode 100644 index 000000000000..5c23e2e24fc5 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/artisan @@ -0,0 +1,53 @@ +#!/usr/bin/env php +make(Illuminate\Contracts\Console\Kernel::class); + +$status = $kernel->handle( + $input = new Symfony\Component\Console\Input\ArgvInput, + new Symfony\Component\Console\Output\ConsoleOutput +); + +/* +|-------------------------------------------------------------------------- +| Shutdown The Application +|-------------------------------------------------------------------------- +| +| Once Artisan has finished running, we will fire off the shutdown events +| so that any final work may be done by the application before we shut +| down the process. This is the last thing to happen to the request. +| +*/ + +$kernel->terminate($input, $status); + +exit($status); diff --git a/samples/server/petstore/php-laravel/lib/bootstrap/app.php b/samples/server/petstore/php-laravel/lib/bootstrap/app.php new file mode 100644 index 000000000000..037e17df03b0 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/bootstrap/app.php @@ -0,0 +1,55 @@ +singleton( + Illuminate\Contracts\Http\Kernel::class, + App\Http\Kernel::class +); + +$app->singleton( + Illuminate\Contracts\Console\Kernel::class, + App\Console\Kernel::class +); + +$app->singleton( + Illuminate\Contracts\Debug\ExceptionHandler::class, + App\Exceptions\Handler::class +); + +/* +|-------------------------------------------------------------------------- +| Return The Application +|-------------------------------------------------------------------------- +| +| This script returns the application instance. The instance is given to +| the calling script so we can separate the building of the instances +| from the actual running of the application and sending responses. +| +*/ + +return $app; diff --git a/samples/server/petstore/php-laravel/lib/bootstrap/cache/.gitignore b/samples/server/petstore/php-laravel/lib/bootstrap/cache/.gitignore new file mode 100644 index 000000000000..01e4a6cda9eb --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/bootstrap/cache/.gitignore @@ -0,0 +1,3 @@ +* +!data/ +!.gitignore diff --git a/samples/server/petstore/php-laravel/lib/composer.json b/samples/server/petstore/php-laravel/lib/composer.json new file mode 100644 index 000000000000..3af54b17108a --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/composer.json @@ -0,0 +1,31 @@ +{ + "name": "openapitools/petstore", + "description": "", + "keywords": [ + "openapi", + "php", + "sdk", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI", + "homepage": "https://openapi-generator.tech" + } + ], + "require": { + "php": ">=8.1", + "laravel/framework": "^10.0", + "crell/serde": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "autoload": { + "psr-4": { + "php-laravel\\" : "" + } + } +} diff --git a/samples/server/petstore/php-laravel/lib/config/app.php b/samples/server/petstore/php-laravel/lib/config/app.php new file mode 100644 index 000000000000..8e9ac940c306 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/app.php @@ -0,0 +1,232 @@ + env('APP_NAME', 'Laravel'), + + /* + |-------------------------------------------------------------------------- + | Application Environment + |-------------------------------------------------------------------------- + | + | This value determines the "environment" your application is currently + | running in. This may determine how you prefer to configure various + | services the application utilizes. Set this in your ".env" file. + | + */ + + 'env' => env('APP_ENV', 'production'), + + /* + |-------------------------------------------------------------------------- + | Application Debug Mode + |-------------------------------------------------------------------------- + | + | When your application is in debug mode, detailed error messages with + | stack traces will be shown on every error that occurs within your + | application. If disabled, a simple generic error page is shown. + | + */ + + 'debug' => (bool) env('APP_DEBUG', false), + + /* + |-------------------------------------------------------------------------- + | Application URL + |-------------------------------------------------------------------------- + | + | This URL is used by the console to properly generate URLs when using + | the Artisan command line tool. You should set this to the root of + | your application so that it is used when running Artisan tasks. + | + */ + + 'url' => env('APP_URL', 'http://localhost'), + + 'asset_url' => env('ASSET_URL', null), + + /* + |-------------------------------------------------------------------------- + | Application Timezone + |-------------------------------------------------------------------------- + | + | Here you may specify the default timezone for your application, which + | will be used by the PHP date and date-time functions. We have gone + | ahead and set this to a sensible default for you out of the box. + | + */ + + 'timezone' => 'UTC', + + /* + |-------------------------------------------------------------------------- + | Application Locale Configuration + |-------------------------------------------------------------------------- + | + | The application locale determines the default locale that will be used + | by the translation service provider. You are free to set this value + | to any of the locales which will be supported by the application. + | + */ + + 'locale' => 'en', + + /* + |-------------------------------------------------------------------------- + | Application Fallback Locale + |-------------------------------------------------------------------------- + | + | The fallback locale determines the locale to use when the current one + | is not available. You may change the value to correspond to any of + | the language folders that are provided through your application. + | + */ + + 'fallback_locale' => 'en', + + /* + |-------------------------------------------------------------------------- + | Faker Locale + |-------------------------------------------------------------------------- + | + | This locale will be used by the Faker PHP library when generating fake + | data for your database seeds. For example, this will be used to get + | localized telephone numbers, street address information and more. + | + */ + + 'faker_locale' => 'en_US', + + /* + |-------------------------------------------------------------------------- + | Encryption Key + |-------------------------------------------------------------------------- + | + | This key is used by the Illuminate encryptor service and should be set + | to a random, 32 character string, otherwise these encrypted strings + | will not be safe. Please do this before deploying an application! + | + */ + + 'key' => env('APP_KEY'), + + 'cipher' => 'AES-256-CBC', + + /* + |-------------------------------------------------------------------------- + | Autoloaded Service Providers + |-------------------------------------------------------------------------- + | + | The service providers listed here will be automatically loaded on the + | request to your application. Feel free to add your own services to + | this array to grant expanded functionality to your applications. + | + */ + + 'providers' => [ + + /* + * Laravel Framework Service Providers... + */ + Illuminate\Auth\AuthServiceProvider::class, + Illuminate\Broadcasting\BroadcastServiceProvider::class, + Illuminate\Bus\BusServiceProvider::class, + Illuminate\Cache\CacheServiceProvider::class, + Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, + Illuminate\Cookie\CookieServiceProvider::class, + Illuminate\Database\DatabaseServiceProvider::class, + Illuminate\Encryption\EncryptionServiceProvider::class, + Illuminate\Filesystem\FilesystemServiceProvider::class, + Illuminate\Foundation\Providers\FoundationServiceProvider::class, + Illuminate\Hashing\HashServiceProvider::class, + Illuminate\Mail\MailServiceProvider::class, + Illuminate\Notifications\NotificationServiceProvider::class, + Illuminate\Pagination\PaginationServiceProvider::class, + Illuminate\Pipeline\PipelineServiceProvider::class, + Illuminate\Queue\QueueServiceProvider::class, + Illuminate\Redis\RedisServiceProvider::class, + Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, + Illuminate\Session\SessionServiceProvider::class, + Illuminate\Translation\TranslationServiceProvider::class, + Illuminate\Validation\ValidationServiceProvider::class, + Illuminate\View\ViewServiceProvider::class, + + /* + * Package Service Providers... + */ + + /* + * Application Service Providers... + */ + App\Providers\AppServiceProvider::class, + App\Providers\AuthServiceProvider::class, + // App\Providers\BroadcastServiceProvider::class, + App\Providers\EventServiceProvider::class, + App\Providers\RouteServiceProvider::class, + + ], + + /* + |-------------------------------------------------------------------------- + | Class Aliases + |-------------------------------------------------------------------------- + | + | This array of class aliases will be registered when this application + | is started. However, feel free to register as many as you wish as + | the aliases are "lazy" loaded so they don't hinder performance. + | + */ + + 'aliases' => [ + + 'App' => Illuminate\Support\Facades\App::class, + 'Arr' => Illuminate\Support\Arr::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Http' => Illuminate\Support\Facades\Http::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, + 'Notification' => Illuminate\Support\Facades\Notification::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redis' => Illuminate\Support\Facades\Redis::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'Str' => Illuminate\Support\Str::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'View' => Illuminate\Support\Facades\View::class, + + ], + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/auth.php b/samples/server/petstore/php-laravel/lib/config/auth.php new file mode 100644 index 000000000000..aaf982bcdcee --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/auth.php @@ -0,0 +1,117 @@ + [ + 'guard' => 'web', + 'passwords' => 'users', + ], + + /* + |-------------------------------------------------------------------------- + | Authentication Guards + |-------------------------------------------------------------------------- + | + | Next, you may define every authentication guard for your application. + | Of course, a great default configuration has been defined for you + | here which uses session storage and the Eloquent user provider. + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | Supported: "session", "token" + | + */ + + 'guards' => [ + 'web' => [ + 'driver' => 'session', + 'provider' => 'users', + ], + + 'api' => [ + 'driver' => 'token', + 'provider' => 'users', + 'hash' => false, + ], + ], + + /* + |-------------------------------------------------------------------------- + | User Providers + |-------------------------------------------------------------------------- + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | If you have multiple user tables or models you may configure multiple + | sources which represent each model / table. These sources may then + | be assigned to any extra authentication guards you have defined. + | + | Supported: "database", "eloquent" + | + */ + + 'providers' => [ + 'users' => [ + 'driver' => 'eloquent', + 'model' => App\User::class, + ], + + // 'users' => [ + // 'driver' => 'database', + // 'table' => 'users', + // ], + ], + + /* + |-------------------------------------------------------------------------- + | Resetting Passwords + |-------------------------------------------------------------------------- + | + | You may specify multiple password reset configurations if you have more + | than one user table or model in the application and you want to have + | separate password reset settings based on the specific user types. + | + | The expire time is the number of minutes that the reset token should be + | considered valid. This security feature keeps tokens short-lived so + | they have less time to be guessed. You may change this as needed. + | + */ + + 'passwords' => [ + 'users' => [ + 'provider' => 'users', + 'table' => 'password_resets', + 'expire' => 60, + 'throttle' => 60, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Password Confirmation Timeout + |-------------------------------------------------------------------------- + | + | Here you may define the amount of seconds before a password confirmation + | times out and the user is prompted to re-enter their password via the + | confirmation screen. By default, the timeout lasts for three hours. + | + */ + + 'password_timeout' => 10800, + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/broadcasting.php b/samples/server/petstore/php-laravel/lib/config/broadcasting.php new file mode 100644 index 000000000000..3bba1103e602 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/broadcasting.php @@ -0,0 +1,59 @@ + env('BROADCAST_DRIVER', 'null'), + + /* + |-------------------------------------------------------------------------- + | Broadcast Connections + |-------------------------------------------------------------------------- + | + | Here you may define all of the broadcast connections that will be used + | to broadcast events to other systems or over websockets. Samples of + | each available type of connection are provided inside this array. + | + */ + + 'connections' => [ + + 'pusher' => [ + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), + 'options' => [ + 'cluster' => env('PUSHER_APP_CLUSTER'), + 'useTLS' => true, + ], + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + ], + + 'log' => [ + 'driver' => 'log', + ], + + 'null' => [ + 'driver' => 'null', + ], + + ], + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/cache.php b/samples/server/petstore/php-laravel/lib/config/cache.php new file mode 100644 index 000000000000..4f41fdf966b5 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/cache.php @@ -0,0 +1,104 @@ + env('CACHE_DRIVER', 'file'), + + /* + |-------------------------------------------------------------------------- + | Cache Stores + |-------------------------------------------------------------------------- + | + | Here you may define all of the cache "stores" for your application as + | well as their drivers. You may even define multiple stores for the + | same cache driver to group types of items stored in your caches. + | + */ + + 'stores' => [ + + 'apc' => [ + 'driver' => 'apc', + ], + + 'array' => [ + 'driver' => 'array', + 'serialize' => false, + ], + + 'database' => [ + 'driver' => 'database', + 'table' => 'cache', + 'connection' => null, + ], + + 'file' => [ + 'driver' => 'file', + 'path' => storage_path('framework/cache/data'), + ], + + 'memcached' => [ + 'driver' => 'memcached', + 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), + 'sasl' => [ + env('MEMCACHED_USERNAME'), + env('MEMCACHED_PASSWORD'), + ], + 'options' => [ + // Memcached::OPT_CONNECT_TIMEOUT => 2000, + ], + 'servers' => [ + [ + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), + 'weight' => 100, + ], + ], + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'cache', + ], + + 'dynamodb' => [ + 'driver' => 'dynamodb', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), + 'endpoint' => env('DYNAMODB_ENDPOINT'), + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Cache Key Prefix + |-------------------------------------------------------------------------- + | + | When utilizing a RAM based store such as APC or Memcached, there might + | be other applications utilizing the same cache. So, we'll specify a + | value to get prefixed to all our keys so we can avoid collisions. + | + */ + + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/cors.php b/samples/server/petstore/php-laravel/lib/config/cors.php new file mode 100644 index 000000000000..558369dca41b --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/cors.php @@ -0,0 +1,34 @@ + ['api/*'], + + 'allowed_methods' => ['*'], + + 'allowed_origins' => ['*'], + + 'allowed_origins_patterns' => [], + + 'allowed_headers' => ['*'], + + 'exposed_headers' => [], + + 'max_age' => 0, + + 'supports_credentials' => false, + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/database.php b/samples/server/petstore/php-laravel/lib/config/database.php new file mode 100644 index 000000000000..b42d9b30a546 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/database.php @@ -0,0 +1,147 @@ + env('DB_CONNECTION', 'mysql'), + + /* + |-------------------------------------------------------------------------- + | Database Connections + |-------------------------------------------------------------------------- + | + | Here are each of the database connections setup for your application. + | Of course, examples of configuring each database platform that is + | supported by Laravel is shown below to make development simple. + | + | + | All database work in Laravel is done through the PHP PDO facilities + | so make sure you have the driver for your particular database of + | choice installed on your machine before you begin development. + | + */ + + 'connections' => [ + + 'sqlite' => [ + 'driver' => 'sqlite', + 'url' => env('DATABASE_URL'), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => '', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), + ], + + 'mysql' => [ + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], + ], + + 'pgsql' => [ + 'driver' => 'pgsql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', + 'prefix_indexes' => true, + 'schema' => 'public', + 'sslmode' => 'prefer', + ], + + 'sqlsrv' => [ + 'driver' => 'sqlsrv', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', + 'prefix_indexes' => true, + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Migration Repository Table + |-------------------------------------------------------------------------- + | + | This table keeps track of all the migrations that have already run for + | your application. Using this information, we can determine which of + | the migrations on disk haven't actually been run in the database. + | + */ + + 'migrations' => 'migrations', + + /* + |-------------------------------------------------------------------------- + | Redis Databases + |-------------------------------------------------------------------------- + | + | Redis is an open source, fast, and advanced key-value store that also + | provides a richer body of commands than a typical key-value system + | such as APC or Memcached. Laravel makes it easy to dig right in. + | + */ + + 'redis' => [ + + 'client' => env('REDIS_CLIENT', 'phpredis'), + + 'options' => [ + 'cluster' => env('REDIS_CLUSTER', 'redis'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + ], + + 'default' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_DB', '0'), + ], + + 'cache' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_CACHE_DB', '1'), + ], + + ], + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/filesystems.php b/samples/server/petstore/php-laravel/lib/config/filesystems.php new file mode 100644 index 000000000000..94c81126b227 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/filesystems.php @@ -0,0 +1,85 @@ + env('FILESYSTEM_DRIVER', 'local'), + + /* + |-------------------------------------------------------------------------- + | Default Cloud Filesystem Disk + |-------------------------------------------------------------------------- + | + | Many applications store files both locally and in the cloud. For this + | reason, you may specify a default "cloud" driver here. This driver + | will be bound as the Cloud disk implementation in the container. + | + */ + + 'cloud' => env('FILESYSTEM_CLOUD', 's3'), + + /* + |-------------------------------------------------------------------------- + | Filesystem Disks + |-------------------------------------------------------------------------- + | + | Here you may configure as many filesystem "disks" as you wish, and you + | may even configure multiple disks of the same driver. Defaults have + | been setup for each driver as an example of the required options. + | + | Supported Drivers: "local", "ftp", "sftp", "s3" + | + */ + + 'disks' => [ + + 'local' => [ + 'driver' => 'local', + 'root' => storage_path('app'), + ], + + 'public' => [ + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL').'/storage', + 'visibility' => 'public', + ], + + 's3' => [ + 'driver' => 's3', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), + 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), + 'endpoint' => env('AWS_ENDPOINT'), + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Symbolic Links + |-------------------------------------------------------------------------- + | + | Here you may configure the symbolic links that will be created when the + | `storage:link` Artisan command is executed. The array keys should be + | the locations of the links and the values should be their targets. + | + */ + + 'links' => [ + public_path('storage') => storage_path('app/public'), + ], + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/hashing.php b/samples/server/petstore/php-laravel/lib/config/hashing.php new file mode 100644 index 000000000000..842577087c0c --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/hashing.php @@ -0,0 +1,52 @@ + 'bcrypt', + + /* + |-------------------------------------------------------------------------- + | Bcrypt Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Bcrypt algorithm. This will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'bcrypt' => [ + 'rounds' => env('BCRYPT_ROUNDS', 10), + ], + + /* + |-------------------------------------------------------------------------- + | Argon Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Argon algorithm. These will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'argon' => [ + 'memory' => 1024, + 'threads' => 2, + 'time' => 2, + ], + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/logging.php b/samples/server/petstore/php-laravel/lib/config/logging.php new file mode 100644 index 000000000000..088c204e2994 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/logging.php @@ -0,0 +1,104 @@ + env('LOG_CHANNEL', 'stack'), + + /* + |-------------------------------------------------------------------------- + | Log Channels + |-------------------------------------------------------------------------- + | + | Here you may configure the log channels for your application. Out of + | the box, Laravel uses the Monolog PHP logging library. This gives + | you a variety of powerful log handlers / formatters to utilize. + | + | Available Drivers: "single", "daily", "slack", "syslog", + | "errorlog", "monolog", + | "custom", "stack" + | + */ + + 'channels' => [ + 'stack' => [ + 'driver' => 'stack', + 'channels' => ['single'], + 'ignore_exceptions' => false, + ], + + 'single' => [ + 'driver' => 'single', + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', + ], + + 'daily' => [ + 'driver' => 'daily', + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', + 'days' => 14, + ], + + 'slack' => [ + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'username' => 'Laravel Log', + 'emoji' => ':boom:', + 'level' => 'critical', + ], + + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => 'debug', + 'handler' => SyslogUdpHandler::class, + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + ], + ], + + 'stderr' => [ + 'driver' => 'monolog', + 'handler' => StreamHandler::class, + 'formatter' => env('LOG_STDERR_FORMATTER'), + 'with' => [ + 'stream' => 'php://stderr', + ], + ], + + 'syslog' => [ + 'driver' => 'syslog', + 'level' => 'debug', + ], + + 'errorlog' => [ + 'driver' => 'errorlog', + 'level' => 'debug', + ], + + 'null' => [ + 'driver' => 'monolog', + 'handler' => NullHandler::class, + ], + + 'emergency' => [ + 'path' => storage_path('logs/laravel.log'), + ], + ], + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/mail.php b/samples/server/petstore/php-laravel/lib/config/mail.php new file mode 100644 index 000000000000..54299aabf8ad --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/mail.php @@ -0,0 +1,110 @@ + env('MAIL_MAILER', 'smtp'), + + /* + |-------------------------------------------------------------------------- + | Mailer Configurations + |-------------------------------------------------------------------------- + | + | Here you may configure all of the mailers used by your application plus + | their respective settings. Several examples have been configured for + | you and you are free to add your own as your application requires. + | + | Laravel supports a variety of mail "transport" drivers to be used while + | sending an e-mail. You will specify which one you are using for your + | mailers below. You are free to add additional mailers as required. + | + | Supported: "smtp", "sendmail", "mailgun", "ses", + | "postmark", "log", "array" + | + */ + + 'mailers' => [ + 'smtp' => [ + 'transport' => 'smtp', + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'port' => env('MAIL_PORT', 587), + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + 'username' => env('MAIL_USERNAME'), + 'password' => env('MAIL_PASSWORD'), + 'timeout' => null, + 'auth_mode' => null, + ], + + 'ses' => [ + 'transport' => 'ses', + ], + + 'mailgun' => [ + 'transport' => 'mailgun', + ], + + 'postmark' => [ + 'transport' => 'postmark', + ], + + 'sendmail' => [ + 'transport' => 'sendmail', + 'path' => '/usr/sbin/sendmail -bs', + ], + + 'log' => [ + 'transport' => 'log', + 'channel' => env('MAIL_LOG_CHANNEL'), + ], + + 'array' => [ + 'transport' => 'array', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Global "From" Address + |-------------------------------------------------------------------------- + | + | You may wish for all e-mails sent by your application to be sent from + | the same address. Here, you may specify a name and address that is + | used globally for all e-mails that are sent by your application. + | + */ + + 'from' => [ + 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'name' => env('MAIL_FROM_NAME', 'Example'), + ], + + /* + |-------------------------------------------------------------------------- + | Markdown Mail Settings + |-------------------------------------------------------------------------- + | + | If you are using Markdown based email rendering, you may configure your + | theme and component paths here, allowing you to customize the design + | of the emails. Or, you may simply stick with the Laravel defaults! + | + */ + + 'markdown' => [ + 'theme' => 'default', + + 'paths' => [ + resource_path('views/vendor/mail'), + ], + ], + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/queue.php b/samples/server/petstore/php-laravel/lib/config/queue.php new file mode 100644 index 000000000000..00b76d651812 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/queue.php @@ -0,0 +1,89 @@ + env('QUEUE_CONNECTION', 'sync'), + + /* + |-------------------------------------------------------------------------- + | Queue Connections + |-------------------------------------------------------------------------- + | + | Here you may configure the connection information for each server that + | is used by your application. A default configuration has been added + | for each back-end shipped with Laravel. You are free to add more. + | + | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | + */ + + 'connections' => [ + + 'sync' => [ + 'driver' => 'sync', + ], + + 'database' => [ + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', + 'retry_after' => 90, + ], + + 'beanstalkd' => [ + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', + 'retry_after' => 90, + 'block_for' => 0, + ], + + 'sqs' => [ + 'driver' => 'sqs', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'your-queue-name'), + 'suffix' => env('SQS_SUFFIX'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), + 'retry_after' => 90, + 'block_for' => null, + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Failed Queue Jobs + |-------------------------------------------------------------------------- + | + | These options configure the behavior of failed queue job logging so you + | can control which database and table are used to store the jobs that + | have failed. You may change them to any database / table you wish. + | + */ + + 'failed' => [ + 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), + 'database' => env('DB_CONNECTION', 'mysql'), + 'table' => 'failed_jobs', + ], + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/services.php b/samples/server/petstore/php-laravel/lib/config/services.php new file mode 100644 index 000000000000..2a1d616c7746 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/services.php @@ -0,0 +1,33 @@ + [ + 'domain' => env('MAILGUN_DOMAIN'), + 'secret' => env('MAILGUN_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), + ], + + 'postmark' => [ + 'token' => env('POSTMARK_TOKEN'), + ], + + 'ses' => [ + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + ], + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/session.php b/samples/server/petstore/php-laravel/lib/config/session.php new file mode 100644 index 000000000000..da692f3b8f79 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/session.php @@ -0,0 +1,199 @@ + env('SESSION_DRIVER', 'file'), + + /* + |-------------------------------------------------------------------------- + | Session Lifetime + |-------------------------------------------------------------------------- + | + | Here you may specify the number of minutes that you wish the session + | to be allowed to remain idle before it expires. If you want them + | to immediately expire on the browser closing, set that option. + | + */ + + 'lifetime' => env('SESSION_LIFETIME', 120), + + 'expire_on_close' => false, + + /* + |-------------------------------------------------------------------------- + | Session Encryption + |-------------------------------------------------------------------------- + | + | This option allows you to easily specify that all of your session data + | should be encrypted before it is stored. All encryption will be run + | automatically by Laravel and you can use the Session like normal. + | + */ + + 'encrypt' => false, + + /* + |-------------------------------------------------------------------------- + | Session File Location + |-------------------------------------------------------------------------- + | + | When using the native session driver, we need a location where session + | files may be stored. A default has been set for you but a different + | location may be specified. This is only needed for file sessions. + | + */ + + 'files' => storage_path('framework/sessions'), + + /* + |-------------------------------------------------------------------------- + | Session Database Connection + |-------------------------------------------------------------------------- + | + | When using the "database" or "redis" session drivers, you may specify a + | connection that should be used to manage these sessions. This should + | correspond to a connection in your database configuration options. + | + */ + + 'connection' => env('SESSION_CONNECTION', null), + + /* + |-------------------------------------------------------------------------- + | Session Database Table + |-------------------------------------------------------------------------- + | + | When using the "database" session driver, you may specify the table we + | should use to manage the sessions. Of course, a sensible default is + | provided for you; however, you are free to change this as needed. + | + */ + + 'table' => 'sessions', + + /* + |-------------------------------------------------------------------------- + | Session Cache Store + |-------------------------------------------------------------------------- + | + | When using the "apc", "memcached", or "dynamodb" session drivers you may + | list a cache store that should be used for these sessions. This value + | must match with one of the application's configured cache "stores". + | + */ + + 'store' => env('SESSION_STORE', null), + + /* + |-------------------------------------------------------------------------- + | Session Sweeping Lottery + |-------------------------------------------------------------------------- + | + | Some session drivers must manually sweep their storage location to get + | rid of old sessions from storage. Here are the chances that it will + | happen on a given request. By default, the odds are 2 out of 100. + | + */ + + 'lottery' => [2, 100], + + /* + |-------------------------------------------------------------------------- + | Session Cookie Name + |-------------------------------------------------------------------------- + | + | Here you may change the name of the cookie used to identify a session + | instance by ID. The name specified here will get used every time a + | new session cookie is created by the framework for every driver. + | + */ + + 'cookie' => env( + 'SESSION_COOKIE', + Str::slug(env('APP_NAME', 'laravel'), '_').'_session' + ), + + /* + |-------------------------------------------------------------------------- + | Session Cookie Path + |-------------------------------------------------------------------------- + | + | The session cookie path determines the path for which the cookie will + | be regarded as available. Typically, this will be the root path of + | your application but you are free to change this when necessary. + | + */ + + 'path' => '/', + + /* + |-------------------------------------------------------------------------- + | Session Cookie Domain + |-------------------------------------------------------------------------- + | + | Here you may change the domain of the cookie used to identify a session + | in your application. This will determine which domains the cookie is + | available to in your application. A sensible default has been set. + | + */ + + 'domain' => env('SESSION_DOMAIN', null), + + /* + |-------------------------------------------------------------------------- + | HTTPS Only Cookies + |-------------------------------------------------------------------------- + | + | By setting this option to true, session cookies will only be sent back + | to the server if the browser has a HTTPS connection. This will keep + | the cookie from being sent to you if it can not be done securely. + | + */ + + 'secure' => env('SESSION_SECURE_COOKIE'), + + /* + |-------------------------------------------------------------------------- + | HTTP Access Only + |-------------------------------------------------------------------------- + | + | Setting this value to true will prevent JavaScript from accessing the + | value of the cookie and the cookie will only be accessible through + | the HTTP protocol. You are free to modify this option if needed. + | + */ + + 'http_only' => true, + + /* + |-------------------------------------------------------------------------- + | Same-Site Cookies + |-------------------------------------------------------------------------- + | + | This option determines how your cookies behave when cross-site requests + | take place, and can be used to mitigate CSRF attacks. By default, we + | will set this value to "lax" since this is a secure default value. + | + | Supported: "lax", "strict", "none", null + | + */ + + 'same_site' => 'lax', + +]; diff --git a/samples/server/petstore/php-laravel/lib/config/view.php b/samples/server/petstore/php-laravel/lib/config/view.php new file mode 100644 index 000000000000..22b8a18d3258 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/config/view.php @@ -0,0 +1,36 @@ + [ + resource_path('views'), + ], + + /* + |-------------------------------------------------------------------------- + | Compiled View Path + |-------------------------------------------------------------------------- + | + | This option determines where all the compiled Blade templates will be + | stored for your application. Typically, this is within the storage + | directory. However, as usual, you are free to change this value. + | + */ + + 'compiled' => env( + 'VIEW_COMPILED_PATH', + realpath(storage_path('framework/views')) + ), + +]; diff --git a/samples/server/petstore/php-laravel/lib/database/.gitignore b/samples/server/petstore/php-laravel/lib/database/.gitignore new file mode 100644 index 000000000000..97fc976772ab --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/database/.gitignore @@ -0,0 +1,2 @@ +*.sqlite +*.sqlite-journal diff --git a/samples/server/petstore/php-laravel/lib/database/factories/UserFactory.php b/samples/server/petstore/php-laravel/lib/database/factories/UserFactory.php new file mode 100644 index 000000000000..741edead6192 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/database/factories/UserFactory.php @@ -0,0 +1,28 @@ +define(User::class, function (Faker $faker) { + return [ + 'name' => $faker->name, + 'email' => $faker->unique()->safeEmail, + 'email_verified_at' => now(), + 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password + 'remember_token' => Str::random(10), + ]; +}); diff --git a/samples/server/petstore/php-laravel/lib/database/migrations/2014_10_12_000000_create_users_table.php b/samples/server/petstore/php-laravel/lib/database/migrations/2014_10_12_000000_create_users_table.php new file mode 100644 index 000000000000..621a24eb734b --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/database/migrations/2014_10_12_000000_create_users_table.php @@ -0,0 +1,36 @@ +id(); + $table->string('name'); + $table->string('email')->unique(); + $table->timestamp('email_verified_at')->nullable(); + $table->string('password'); + $table->rememberToken(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('users'); + } +} diff --git a/samples/server/petstore/php-laravel/lib/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/samples/server/petstore/php-laravel/lib/database/migrations/2019_08_19_000000_create_failed_jobs_table.php new file mode 100644 index 000000000000..9bddee36cb3f --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -0,0 +1,35 @@ +id(); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('failed_jobs'); + } +} diff --git a/samples/server/petstore/php-laravel/lib/database/seeds/DatabaseSeeder.php b/samples/server/petstore/php-laravel/lib/database/seeds/DatabaseSeeder.php new file mode 100644 index 000000000000..237dfc5d0d82 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/database/seeds/DatabaseSeeder.php @@ -0,0 +1,16 @@ +call(UserSeeder::class); + } +} diff --git a/samples/server/petstore/php-laravel/lib/package.json b/samples/server/petstore/php-laravel/lib/package.json new file mode 100644 index 000000000000..2c35181c9b14 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/package.json @@ -0,0 +1,21 @@ +{ + "private": true, + "scripts": { + "dev": "npm run development", + "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "watch": "npm run development -- --watch", + "watch-poll": "npm run watch -- --watch-poll", + "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js", + "prod": "npm run production", + "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" + }, + "devDependencies": { + "axios": "^0.19", + "cross-env": "^7.0", + "laravel-mix": "^5.0.1", + "lodash": "^4.17.13", + "resolve-url-loader": "^3.1.0", + "sass": "^1.15.2", + "sass-loader": "^8.0.0" + } +} diff --git a/samples/server/petstore/php-laravel/lib/phpunit.xml b/samples/server/petstore/php-laravel/lib/phpunit.xml new file mode 100644 index 000000000000..964ff0c5717e --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/phpunit.xml @@ -0,0 +1,31 @@ + + + + + ./tests/Unit + + + ./tests/Feature + + + + + ./app + + + + + + + + + + + + + + diff --git a/samples/server/petstore/php-laravel/lib/public/.htaccess b/samples/server/petstore/php-laravel/lib/public/.htaccess new file mode 100644 index 000000000000..3aec5e27e5db --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/public/.htaccess @@ -0,0 +1,21 @@ + + + Options -MultiViews -Indexes + + + RewriteEngine On + + # Handle Authorization Header + RewriteCond %{HTTP:Authorization} . + RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + + # Redirect Trailing Slashes If Not A Folder... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_URI} (.+)/$ + RewriteRule ^ %1 [L,R=301] + + # Send Requests To Front Controller... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + diff --git a/samples/server/petstore/php-laravel/lib/public/favicon.ico b/samples/server/petstore/php-laravel/lib/public/favicon.ico new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/server/petstore/php-laravel/lib/public/index.php b/samples/server/petstore/php-laravel/lib/public/index.php new file mode 100644 index 000000000000..4584cbcd6ad5 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/public/index.php @@ -0,0 +1,60 @@ + + */ + +define('LARAVEL_START', microtime(true)); + +/* +|-------------------------------------------------------------------------- +| Register The Auto Loader +|-------------------------------------------------------------------------- +| +| Composer provides a convenient, automatically generated class loader for +| our application. We just need to utilize it! We'll simply require it +| into the script here so that we don't have to worry about manual +| loading any of our classes later on. It feels great to relax. +| +*/ + +require __DIR__.'/../vendor/autoload.php'; + +/* +|-------------------------------------------------------------------------- +| Turn On The Lights +|-------------------------------------------------------------------------- +| +| We need to illuminate PHP development, so let us turn on the lights. +| This bootstraps the framework and gets it ready for use, then it +| will load up this application so that we can run it and send +| the responses back to the browser and delight our users. +| +*/ + +$app = require_once __DIR__.'/../bootstrap/app.php'; + +/* +|-------------------------------------------------------------------------- +| Run The Application +|-------------------------------------------------------------------------- +| +| Once we have the application, we can handle the incoming request +| through the kernel, and send the associated response back to +| the client's browser allowing them to enjoy the creative +| and wonderful application we have prepared for them. +| +*/ + +$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); + +$response = $kernel->handle( + $request = Illuminate\Http\Request::capture() +); + +$response->send(); + +$kernel->terminate($request, $response); diff --git a/samples/server/petstore/php-laravel/lib/public/robots.txt b/samples/server/petstore/php-laravel/lib/public/robots.txt new file mode 100644 index 000000000000..eb0536286f30 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: diff --git a/samples/server/petstore/php-laravel/lib/public/web.config b/samples/server/petstore/php-laravel/lib/public/web.config new file mode 100644 index 000000000000..d3711d7c5b8e --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/public/web.config @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/server/petstore/php-laravel/lib/resources/assets/js/app.js b/samples/server/petstore/php-laravel/lib/resources/assets/js/app.js new file mode 100644 index 000000000000..40c55f65c256 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/resources/assets/js/app.js @@ -0,0 +1 @@ +require('./bootstrap'); diff --git a/samples/server/petstore/php-laravel/lib/resources/assets/js/bootstrap.js b/samples/server/petstore/php-laravel/lib/resources/assets/js/bootstrap.js new file mode 100644 index 000000000000..6922577695e6 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/resources/assets/js/bootstrap.js @@ -0,0 +1,28 @@ +window._ = require('lodash'); + +/** + * We'll load the axios HTTP library which allows us to easily issue requests + * to our Laravel back-end. This library automatically handles sending the + * CSRF token as a header based on the value of the "XSRF" token cookie. + */ + +window.axios = require('axios'); + +window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; + +/** + * Echo exposes an expressive API for subscribing to channels and listening + * for events that are broadcast by Laravel. Echo and event broadcasting + * allows your team to easily build robust real-time web applications. + */ + +// import Echo from 'laravel-echo'; + +// window.Pusher = require('pusher-js'); + +// window.Echo = new Echo({ +// broadcaster: 'pusher', +// key: process.env.MIX_PUSHER_APP_KEY, +// cluster: process.env.MIX_PUSHER_APP_CLUSTER, +// forceTLS: true +// }); diff --git a/samples/server/petstore/php-laravel/lib/resources/assets/sass/app.scss b/samples/server/petstore/php-laravel/lib/resources/assets/sass/app.scss new file mode 100644 index 000000000000..8337712ea57f --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/resources/assets/sass/app.scss @@ -0,0 +1 @@ +// diff --git a/samples/server/petstore/php-laravel/lib/resources/lang/en/auth.php b/samples/server/petstore/php-laravel/lib/resources/lang/en/auth.php new file mode 100644 index 000000000000..e5506df2907a --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/resources/lang/en/auth.php @@ -0,0 +1,19 @@ + 'These credentials do not match our records.', + 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', + +]; diff --git a/samples/server/petstore/php-laravel/lib/resources/lang/en/pagination.php b/samples/server/petstore/php-laravel/lib/resources/lang/en/pagination.php new file mode 100644 index 000000000000..d48141187786 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/resources/lang/en/pagination.php @@ -0,0 +1,19 @@ + '« Previous', + 'next' => 'Next »', + +]; diff --git a/samples/server/petstore/php-laravel/lib/resources/lang/en/passwords.php b/samples/server/petstore/php-laravel/lib/resources/lang/en/passwords.php new file mode 100644 index 000000000000..2345a56b5a69 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/resources/lang/en/passwords.php @@ -0,0 +1,22 @@ + 'Your password has been reset!', + 'sent' => 'We have emailed your password reset link!', + 'throttled' => 'Please wait before retrying.', + 'token' => 'This password reset token is invalid.', + 'user' => "We can't find a user with that email address.", + +]; diff --git a/samples/server/petstore/php-laravel/lib/resources/lang/en/validation.php b/samples/server/petstore/php-laravel/lib/resources/lang/en/validation.php new file mode 100644 index 000000000000..a65914f9d0f2 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/resources/lang/en/validation.php @@ -0,0 +1,151 @@ + 'The :attribute must be accepted.', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'before' => 'The :attribute must be a date before :date.', + 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', + 'between' => [ + 'numeric' => 'The :attribute must be between :min and :max.', + 'file' => 'The :attribute must be between :min and :max kilobytes.', + 'string' => 'The :attribute must be between :min and :max characters.', + 'array' => 'The :attribute must have between :min and :max items.', + ], + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_equals' => 'The :attribute must be a date equal to :date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'dimensions' => 'The :attribute has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'email' => 'The :attribute must be a valid email address.', + 'ends_with' => 'The :attribute must end with one of the following: :values.', + 'exists' => 'The selected :attribute is invalid.', + 'file' => 'The :attribute must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'gt' => [ + 'numeric' => 'The :attribute must be greater than :value.', + 'file' => 'The :attribute must be greater than :value kilobytes.', + 'string' => 'The :attribute must be greater than :value characters.', + 'array' => 'The :attribute must have more than :value items.', + ], + 'gte' => [ + 'numeric' => 'The :attribute must be greater than or equal :value.', + 'file' => 'The :attribute must be greater than or equal :value kilobytes.', + 'string' => 'The :attribute must be greater than or equal :value characters.', + 'array' => 'The :attribute must have :value items or more.', + ], + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field does not exist in :other.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'ipv4' => 'The :attribute must be a valid IPv4 address.', + 'ipv6' => 'The :attribute must be a valid IPv6 address.', + 'json' => 'The :attribute must be a valid JSON string.', + 'lt' => [ + 'numeric' => 'The :attribute must be less than :value.', + 'file' => 'The :attribute must be less than :value kilobytes.', + 'string' => 'The :attribute must be less than :value characters.', + 'array' => 'The :attribute must have less than :value items.', + ], + 'lte' => [ + 'numeric' => 'The :attribute must be less than or equal :value.', + 'file' => 'The :attribute must be less than or equal :value kilobytes.', + 'string' => 'The :attribute must be less than or equal :value characters.', + 'array' => 'The :attribute must not have more than :value items.', + ], + 'max' => [ + 'numeric' => 'The :attribute may not be greater than :max.', + 'file' => 'The :attribute may not be greater than :max kilobytes.', + 'string' => 'The :attribute may not be greater than :max characters.', + 'array' => 'The :attribute may not have more than :max items.', + ], + 'mimes' => 'The :attribute must be a file of type: :values.', + 'mimetypes' => 'The :attribute must be a file of type: :values.', + 'min' => [ + 'numeric' => 'The :attribute must be at least :min.', + 'file' => 'The :attribute must be at least :min kilobytes.', + 'string' => 'The :attribute must be at least :min characters.', + 'array' => 'The :attribute must have at least :min items.', + ], + 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute format is invalid.', + 'numeric' => 'The :attribute must be a number.', + 'password' => 'The password is incorrect.', + 'present' => 'The :attribute field must be present.', + 'regex' => 'The :attribute format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values are present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute and :other must match.', + 'size' => [ + 'numeric' => 'The :attribute must be :size.', + 'file' => 'The :attribute must be :size kilobytes.', + 'string' => 'The :attribute must be :size characters.', + 'array' => 'The :attribute must contain :size items.', + ], + 'starts_with' => 'The :attribute must start with one of the following: :values.', + 'string' => 'The :attribute must be a string.', + 'timezone' => 'The :attribute must be a valid zone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'url' => 'The :attribute format is invalid.', + 'uuid' => 'The :attribute must be a valid UUID.', + + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ + + 'custom' => [ + 'attribute-name' => [ + 'rule-name' => 'custom-message', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap our attribute placeholder + | with something more reader friendly such as "E-Mail Address" instead + | of "email". This simply helps us make our message more expressive. + | + */ + + 'attributes' => [], + +]; diff --git a/samples/server/petstore/php-laravel/lib/resources/views/welcome.blade.php b/samples/server/petstore/php-laravel/lib/resources/views/welcome.blade.php new file mode 100644 index 000000000000..3fb48cc02c90 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/resources/views/welcome.blade.php @@ -0,0 +1,100 @@ + + + + + + + Laravel + + + + + + + + +
+ @if (Route::has('login')) + + @endif + +
+
+ Laravel +
+ + +
+
+ + diff --git a/samples/server/petstore/php-laravel/lib/routes/api.php b/samples/server/petstore/php-laravel/lib/routes/api.php new file mode 100644 index 000000000000..7f1a9f1bf164 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/routes/api.php @@ -0,0 +1,349 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Route; + +/** + * patch call123TestSpecialTags + * Summary: To test special tags + * Notes: To test special tags and operation ID starting with number + * Output-Formats: [application/json] + */ +Route::patch('/v2/another-fake/dummy', 'AnotherFakeController@call123TestSpecialTags'); +/** + * get fooGet + * Summary: + * Notes: + * Output-Formats: [application/json] + */ +Route::get('/v2/foo', 'DefaultController@fooGet'); +/** + * patch testClientModel + * Summary: To test \"client\" model + * Notes: To test \"client\" model + * Output-Formats: [application/json] + */ +Route::patch('/v2/fake', 'FakeController@testClientModel'); +/** + * post testEndpointParameters + * Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + + */ +Route::post('/v2/fake', 'FakeController@testEndpointParameters'); +/** + * get testEnumParameters + * Summary: To test enum parameters + * Notes: To test enum parameters + + */ +Route::get('/v2/fake', 'FakeController@testEnumParameters'); +/** + * delete testGroupParameters + * Summary: Fake endpoint to test group parameters (optional) + * Notes: Fake endpoint to test group parameters (optional) + + */ +Route::delete('/v2/fake', 'FakeController@testGroupParameters'); +/** + * get fakeBigDecimalMap + * Summary: + * Notes: for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * Output-Formats: [*_/_*] + */ +Route::get('/v2/fake/BigDecimalMap', 'FakeController@fakeBigDecimalMap'); +/** + * post testAdditionalPropertiesReference + * Summary: test referenced additionalProperties + * Notes: + + */ +Route::post('/v2/fake/additionalProperties-reference', 'FakeController@testAdditionalPropertiesReference'); +/** + * put testBodyWithBinary + * Summary: + * Notes: For this test, the body has to be a binary file. + + */ +Route::put('/v2/fake/body-with-binary', 'FakeController@testBodyWithBinary'); +/** + * put testBodyWithFileSchema + * Summary: + * Notes: For this test, the body for this request must reference a schema named `File`. + + */ +Route::put('/v2/fake/body-with-file-schema', 'FakeController@testBodyWithFileSchema'); +/** + * put testBodyWithQueryParams + * Summary: + * Notes: + + */ +Route::put('/v2/fake/body-with-query-params', 'FakeController@testBodyWithQueryParams'); +/** + * get fakeHealthGet + * Summary: Health check endpoint + * Notes: + * Output-Formats: [application/json] + */ +Route::get('/v2/fake/health', 'FakeController@fakeHealthGet'); +/** + * get fakeHttpSignatureTest + * Summary: test http signature authentication + * Notes: + + */ +Route::get('/v2/fake/http-signature-test', 'FakeController@fakeHttpSignatureTest'); +/** + * post testInlineAdditionalProperties + * Summary: test inline additionalProperties + * Notes: + + */ +Route::post('/v2/fake/inline-additionalProperties', 'FakeController@testInlineAdditionalProperties'); +/** + * post testInlineFreeformAdditionalProperties + * Summary: test inline free-form additionalProperties + * Notes: + + */ +Route::post('/v2/fake/inline-freeform-additionalProperties', 'FakeController@testInlineFreeformAdditionalProperties'); +/** + * get testJsonFormData + * Summary: test json serialization of form data + * Notes: + + */ +Route::get('/v2/fake/jsonFormData', 'FakeController@testJsonFormData'); +/** + * post testNullable + * Summary: test nullable parent property + * Notes: + + */ +Route::post('/v2/fake/nullable', 'FakeController@testNullable'); +/** + * post fakeOuterBooleanSerialize + * Summary: + * Notes: Test serialization of outer boolean types + * Output-Formats: [*_/_*] + */ +Route::post('/v2/fake/outer/boolean', 'FakeController@fakeOuterBooleanSerialize'); +/** + * post fakeOuterCompositeSerialize + * Summary: + * Notes: Test serialization of object with outer number type + * Output-Formats: [*_/_*] + */ +Route::post('/v2/fake/outer/composite', 'FakeController@fakeOuterCompositeSerialize'); +/** + * post fakeOuterNumberSerialize + * Summary: + * Notes: Test serialization of outer number types + * Output-Formats: [*_/_*] + */ +Route::post('/v2/fake/outer/number', 'FakeController@fakeOuterNumberSerialize'); +/** + * post fakeOuterStringSerialize + * Summary: + * Notes: Test serialization of outer string types + * Output-Formats: [*_/_*] + */ +Route::post('/v2/fake/outer/string', 'FakeController@fakeOuterStringSerialize'); +/** + * post fakePropertyEnumIntegerSerialize + * Summary: + * Notes: Test serialization of enum (int) properties with examples + * Output-Formats: [*_/_*] + */ +Route::post('/v2/fake/property/enum-int', 'FakeController@fakePropertyEnumIntegerSerialize'); +/** + * post testStringMapReference + * Summary: test referenced string map + * Notes: + + */ +Route::post('/v2/fake/stringMap-reference', 'FakeController@testStringMapReference'); +/** + * put testQueryParameterCollectionFormat + * Summary: + * Notes: To test the collection format in query parameters + + */ +Route::put('/v2/fake/test-query-parameters', 'FakeController@testQueryParameterCollectionFormat'); +/** + * patch testClassname + * Summary: To test class name in snake case + * Notes: To test class name in snake case + * Output-Formats: [application/json] + */ +Route::patch('/v2/fake_classname_test', 'FakeClassnameTags123Controller@testClassname'); +/** + * post uploadFileWithRequiredFile + * Summary: uploads an image (required) + * Notes: + * Output-Formats: [application/json] + */ +Route::post('/v2/fake/{petId}/uploadImageWithRequiredFile', 'PetController@uploadFileWithRequiredFile'); +/** + * post addPet + * Summary: Add a new pet to the store + * Notes: + + */ +Route::post('/v2/pet', 'PetController@addPet'); +/** + * put updatePet + * Summary: Update an existing pet + * Notes: + + */ +Route::put('/v2/pet', 'PetController@updatePet'); +/** + * get findPetsByStatus + * Summary: Finds Pets by status + * Notes: Multiple status values can be provided with comma separated strings + * Output-Formats: [application/xml, application/json] + */ +Route::get('/v2/pet/findByStatus', 'PetController@findPetsByStatus'); +/** + * get findPetsByTags + * Summary: Finds Pets by tags + * Notes: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Output-Formats: [application/xml, application/json] + */ +Route::get('/v2/pet/findByTags', 'PetController@findPetsByTags'); +/** + * delete deletePet + * Summary: Deletes a pet + * Notes: + + */ +Route::delete('/v2/pet/{petId}', 'PetController@deletePet'); +/** + * get getPetById + * Summary: Find pet by ID + * Notes: Returns a single pet + * Output-Formats: [application/xml, application/json] + */ +Route::get('/v2/pet/{petId}', 'PetController@getPetById'); +/** + * post updatePetWithForm + * Summary: Updates a pet in the store with form data + * Notes: + + */ +Route::post('/v2/pet/{petId}', 'PetController@updatePetWithForm'); +/** + * post uploadFile + * Summary: uploads an image + * Notes: + * Output-Formats: [application/json] + */ +Route::post('/v2/pet/{petId}/uploadImage', 'PetController@uploadFile'); +/** + * get getInventory + * Summary: Returns pet inventories by status + * Notes: Returns a map of status codes to quantities + * Output-Formats: [application/json] + */ +Route::get('/v2/store/inventory', 'StoreController@getInventory'); +/** + * post placeOrder + * Summary: Place an order for a pet + * Notes: + * Output-Formats: [application/xml, application/json] + */ +Route::post('/v2/store/order', 'StoreController@placeOrder'); +/** + * delete deleteOrder + * Summary: Delete purchase order by ID + * Notes: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + + */ +Route::delete('/v2/store/order/{order_id}', 'StoreController@deleteOrder'); +/** + * get getOrderById + * Summary: Find purchase order by ID + * Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Output-Formats: [application/xml, application/json] + */ +Route::get('/v2/store/order/{order_id}', 'StoreController@getOrderById'); +/** + * post createUser + * Summary: Create user + * Notes: This can only be done by the logged in user. + + */ +Route::post('/v2/user', 'UserController@createUser'); +/** + * post createUsersWithArrayInput + * Summary: Creates list of users with given input array + * Notes: + + */ +Route::post('/v2/user/createWithArray', 'UserController@createUsersWithArrayInput'); +/** + * post createUsersWithListInput + * Summary: Creates list of users with given input array + * Notes: + + */ +Route::post('/v2/user/createWithList', 'UserController@createUsersWithListInput'); +/** + * get loginUser + * Summary: Logs user into the system + * Notes: + * Output-Formats: [application/xml, application/json] + */ +Route::get('/v2/user/login', 'UserController@loginUser'); +/** + * get logoutUser + * Summary: Logs out current logged in user session + * Notes: + + */ +Route::get('/v2/user/logout', 'UserController@logoutUser'); +/** + * delete deleteUser + * Summary: Delete user + * Notes: This can only be done by the logged in user. + + */ +Route::delete('/v2/user/{username}', 'UserController@deleteUser'); +/** + * get getUserByName + * Summary: Get user by user name + * Notes: + * Output-Formats: [application/xml, application/json] + */ +Route::get('/v2/user/{username}', 'UserController@getUserByName'); +/** + * put updateUser + * Summary: Updated user + * Notes: This can only be done by the logged in user. + + */ +Route::put('/v2/user/{username}', 'UserController@updateUser'); + +Route::middleware('auth:api')->get('/user', function (Request $request) { + return $request->user(); +}); diff --git a/samples/server/petstore/php-laravel/lib/routes/channels.php b/samples/server/petstore/php-laravel/lib/routes/channels.php new file mode 100644 index 000000000000..e8d267d574a9 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/routes/channels.php @@ -0,0 +1,25 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +use Illuminate\Support\Facades\Broadcast; + +Broadcast::channel('App.User.{id}', function ($user, $id) { + return (int) $user->id === (int) $id; +}); diff --git a/samples/server/petstore/php-laravel/lib/routes/console.php b/samples/server/petstore/php-laravel/lib/routes/console.php new file mode 100644 index 000000000000..1cde06dc2eb3 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/routes/console.php @@ -0,0 +1,26 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +use Illuminate\Foundation\Inspiring; +use Illuminate\Support\Facades\Artisan; + +Artisan::command('inspire', function () { + $this->comment(Inspiring::quote()); +})->describe('Display an inspiring quote'); \ No newline at end of file diff --git a/samples/server/petstore/php-laravel/lib/routes/web.php b/samples/server/petstore/php-laravel/lib/routes/web.php new file mode 100644 index 000000000000..be41cc7fb42b --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/routes/web.php @@ -0,0 +1,25 @@ + https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ + */ + + +use Illuminate\Support\Facades\Route; + +Route::get('/', function () { + return view('welcome'); +}); \ No newline at end of file diff --git a/samples/server/petstore/php-laravel/lib/server.php b/samples/server/petstore/php-laravel/lib/server.php new file mode 100644 index 000000000000..5fb6379e71f2 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/server.php @@ -0,0 +1,21 @@ + + */ + +$uri = urldecode( + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) +); + +// This file allows us to emulate Apache's "mod_rewrite" functionality from the +// built-in PHP web server. This provides a convenient way to test a Laravel +// application without having installed a "real" web server software here. +if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { + return false; +} + +require_once __DIR__.'/public/index.php'; diff --git a/samples/server/petstore/php-laravel/lib/storage/app/.gitignore b/samples/server/petstore/php-laravel/lib/storage/app/.gitignore new file mode 100644 index 000000000000..8f4803c05638 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/storage/app/.gitignore @@ -0,0 +1,3 @@ +* +!public/ +!.gitignore diff --git a/samples/server/petstore/php-laravel/lib/storage/app/public/.gitignore b/samples/server/petstore/php-laravel/lib/storage/app/public/.gitignore new file mode 100644 index 000000000000..d6b7ef32c847 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/storage/app/public/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/samples/server/petstore/php-laravel/lib/storage/framework/.gitignore b/samples/server/petstore/php-laravel/lib/storage/framework/.gitignore new file mode 100644 index 000000000000..b02b700f1bfc --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/storage/framework/.gitignore @@ -0,0 +1,8 @@ +config.php +routes.php +schedule-* +compiled.php +services.json +events.scanned.php +routes.scanned.php +down diff --git a/samples/server/petstore/php-laravel/lib/storage/framework/cache/.gitignore b/samples/server/petstore/php-laravel/lib/storage/framework/cache/.gitignore new file mode 100644 index 000000000000..d6b7ef32c847 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/storage/framework/cache/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/samples/server/petstore/php-laravel/lib/storage/framework/sessions/.gitignore b/samples/server/petstore/php-laravel/lib/storage/framework/sessions/.gitignore new file mode 100644 index 000000000000..d6b7ef32c847 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/storage/framework/sessions/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/samples/server/petstore/php-laravel/lib/storage/framework/testing/.gitignore b/samples/server/petstore/php-laravel/lib/storage/framework/testing/.gitignore new file mode 100644 index 000000000000..d6b7ef32c847 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/storage/framework/testing/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/samples/server/petstore/php-laravel/lib/storage/framework/views/.gitignore b/samples/server/petstore/php-laravel/lib/storage/framework/views/.gitignore new file mode 100644 index 000000000000..d6b7ef32c847 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/storage/framework/views/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/samples/server/petstore/php-laravel/lib/storage/logs/.gitignore b/samples/server/petstore/php-laravel/lib/storage/logs/.gitignore new file mode 100644 index 000000000000..d6b7ef32c847 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/storage/logs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/samples/server/petstore/php-laravel/lib/tests/CreatesApplication.php b/samples/server/petstore/php-laravel/lib/tests/CreatesApplication.php new file mode 100644 index 000000000000..547152f6a933 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/tests/CreatesApplication.php @@ -0,0 +1,22 @@ +make(Kernel::class)->bootstrap(); + + return $app; + } +} diff --git a/samples/server/petstore/php-laravel/lib/tests/Feature/ExampleTest.php b/samples/server/petstore/php-laravel/lib/tests/Feature/ExampleTest.php new file mode 100644 index 000000000000..cdb5111934c5 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/tests/Feature/ExampleTest.php @@ -0,0 +1,21 @@ +get('/'); + + $response->assertStatus(200); + } +} diff --git a/samples/server/petstore/php-laravel/lib/tests/TestCase.php b/samples/server/petstore/php-laravel/lib/tests/TestCase.php new file mode 100644 index 000000000000..2932d4a69d65 --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/tests/TestCase.php @@ -0,0 +1,10 @@ +assertTrue(true); + } +} diff --git a/samples/server/petstore/php-laravel/lib/webpack.mix.js b/samples/server/petstore/php-laravel/lib/webpack.mix.js new file mode 100644 index 000000000000..8a923cbb4baf --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/webpack.mix.js @@ -0,0 +1,15 @@ +const mix = require('laravel-mix'); + +/* + |-------------------------------------------------------------------------- + | Mix Asset Management + |-------------------------------------------------------------------------- + | + | Mix provides a clean, fluent API for defining some Webpack build steps + | for your Laravel application. By default, we are compiling the Sass + | file for the application as well as bundling up all the JS files. + | + */ + +mix.js('resources/js/app.js', 'public/js') + .sass('resources/sass/app.scss', 'public/css');