openapi-generator/samples/server/petstore/ze-ph
Articus 60e3339aa6 [Feature][PHP] Update for ze-ph generator (#7472)
* update for ze-ph generator stub to support Zend Expressive 2.1 and Path Handler 0.3

* ze-ph: for each operation generator creates special DTO model from its query parameters

* ze-ph: generation of extra TODO's for complex container type and update for samples
2018-01-24 12:36:24 +08:00
..
.swagger-codegen [Feature][PHP] Update for ze-ph generator (#7472) 2018-01-24 12:36:24 +08:00
application [Feature][PHP] Update for ze-ph generator (#7472) 2018-01-24 12:36:24 +08:00
public Zend Expressive fix and upgrade to version 2 (#6461) 2017-09-23 15:31:20 +08:00
src/App [Feature][PHP] Update for ze-ph generator (#7472) 2018-01-24 12:36:24 +08:00
.swagger-codegen-ignore PHP server generator ze-ph (Zend Expressive + Path Handler) (#4559) 2017-01-16 01:05:04 +08:00
composer.json [Feature][PHP] Update for ze-ph generator (#7472) 2018-01-24 12:36:24 +08:00
README.md [Feature][PHP] Update for ze-ph generator (#7472) 2018-01-24 12:36:24 +08:00

Swagger generated server

Generated by the swagger-codegen project.

Overview

This server stub aims to provide light, yet comprehensive structure for your API project using:

How to use

All you have to do to start development is:

  • install dependencies via Composer
  • create cache folder: mkdir -p ./data/cache/ZendCache (you will need it later for configuration and metadata caches - check comments in ./application/conig.yml)
  • start PHP development server: php -S 0.0.0.0:8080 -t ./public (or any other SAPI you prefer, just make sure that you configure webroot to ./public and rewrites to ./public/index.php)

After that you should be able to call all methods from your API spec. Most of the negative scenarios should be handled:

  • 404 Not found for unknown routes
  • 406 Not acceptable for invalid Accept header
  • 415 Unsupported media type for invalid Content-Type header
  • 400 Malformed JSON for unparsable JSON body
  • 422 Unprocessable entity for parsable JSON body that fails validation

But for obvious reason you will not get any 200 OK, only 500 Not implemented. So your next steps are:

  • check all TODOs left in the stub code where generator was not smart enough and could not guarantee correct implementation
  • implement your API security mechanism (either special attribute or separate middleware) - generator does not do anything about it yet
  • implement your handlers - the most tricky part :)

Enjoy!

Hopefully this stub will reduce the amount of boilerplate code you have to write manually. If you have any suggestions or questions about ze-ph generator, feel free to create issue either in Path Handler repository or in Swagger Codegen repository.