Make Gii accessible via Restful API

Right now you have to use Forms to submit information in Gii. That is good, but it would be better if we could do code generation via an API. That will remove the need for Tools (IDEs et al) to be able to generate things using their own “forms” and just POST to API, than now when you have to use ./yii for generating codes automatically.

Using ./yii in code generation is difficult (you have to manage the launched process on different thread to avoid blocking the UI which adds overhead). Also managing response message especially in case of error is difficult.

My Proposal is:

  1. Move all Gii functionalities to REST API
  2. The current UI should be only a front end to that API

Do you plan developing Gii plugin for a certain IDE?

Yes. We have our Own IDE that we use for internal development and automating code generation was a nightmare. Only viable option was ./yii and it was a terrible experience since it wasn’t designed with IDE/Autocode generator in mind.

On Other hand we had a nice experience with TernJs simply because it had an API for communication.

To answer your question is Yes. Other IDEs will also benefit.

1 Like

Sounds interesting but it certainly isn’t high priority feature. REST API could be added later. Please create an issue in yiisoft/yii-gii not to forget it. Thanks.

Opened ticket: https://github.com/yiisoft/yii-gii/issues/15

1 Like

Gii generator is very complicate device. If it move to REST, add additional layer do Gii more complicate.

How will the API complicate things since it does not add completely new functionality? It will re-use the same code that is already working and add few REST specific stuffs. Can you be more specific as to the source of complexity?

THE WEB forms are one of the most important benefits of Gii, where set up the necessary parameters. I doubt that there will be realised in the inside of the IDE. I’d like the option when Gii works that an independent WEB service. For example, if you are creating Yii APIs for an application, it is prohibitive to launch Gii.