swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.04k stars 6.03k forks source link

Why use php-symfony instead of php? #7909

Closed ndbroadbent closed 6 years ago

ndbroadbent commented 6 years ago

So I understand that Symfony is a PHP framework, but what advantage is there to generating a php-symfony library? Can you also use the php library in a Symfony application?

I'm new to PHP (and Symfony), so I'm not sure which client library I should generate for my users. My API is very simple, so maybe I should just generate the php library?

ndbroadbent commented 6 years ago

I'm also really confused by the rails5 language. It looks like it creates a Rails application that stores all the API responses in a database? EDIT: I understand now, this is a "server" generator that can be used to mock responses.

Does php-symfony also create a Symfony application that stores responses in the database?

liamdennehy commented 6 years ago

So I understand that Symfony is a PHP framework, but what advantage is there to generating a php-symfony library?

Symfony already has a particular coding style and framework for interfaces and routing, while raw PHP is a free-for-all, so it makes sense to adopt a popular framework. Unfortunately it's not 4.x compatible at the moment, and the instructions could use a cleanup even for 3.x.

ndbroadbent commented 6 years ago

Thanks @liamdennehy! Back then I was just confused about the difference between API clients and server stubs. I thought I was generating a PHP Symfony API client, which didn't make sense to me. (e.g. an API client that could only be used by Symfony web applications.)

Now I understand that there is only one PHP generator for API clients, but there's a few different options for generating PHP server stubs.

The Java situation is still a bit confusing though:

Java (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client)

It would be nice if there was one recommended way to generate a Java client, because I don't know anything about all these different libraries, which one is the most popular, which one is easiest to use, etc. (I imagine that people might have some strong / conflicting opinions about this.)

ndbroadbent commented 6 years ago

Closing this for now though, I'm not confused about the PHP client any more