Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
first draft of the extension generator #2411
Enter the desired values to create a Yii2 extension ready for usage with composer.
This is not final yet. I need some input.
Q: Should we enforce the
Q: Which values should be available for
Q: How to handle the array input for keywords?
Q: Should title also be autogenerated?
Q: Where should the extension be generated?
Q: What do you think about the testing explanation.
Validation and Prefix and Namespace rendering have to be improved, but I wanted to clear the above points first.
Nope, based on our previous discussion.
We probably don't need this input field. This generator should only be used to generate extensions. Besides extensions, users may also want to generate application templates, which should be handled by a different generator, IMO.
Make it simple. Just use comma as the separator. No brackets. User can always fine tune the composer file.
Again, keep it simple. No auto generation (how would you generate it from, anyway?)
I don't understand ...
But I'd then set
The type field is very crucial IMO, because this is the one field you really can use for filtering, tags and name is pretty much useless.
Will modify the keyword section.
Autogenerating (it's merely a type hint) the namespace should just help the user to get familiar with namespaces. You can still change that if you want to.
Sorry, but in
I meant the explanation have you've generated an extension, I'll add some screens...
I'm wondering if we really need this generator (sorry...)
Gii is designed to generate code to be part of the application it is running in. Based on the discussion and your screenshot, it seems all this generator does is mainly to fill in the
It perhaps is more convenient that we provide a template and users copy it to the place they want and modify it directly. As long as
The main advantage of the generator is, that it guides the user through the process of creating an extension. It is similar to
Forking an skeleton-extension is also not perfect, because every extension will be a fork of the skeleton, very confusing, IMHO.
And to be honest, one of the biggest problems in Yii1 was, that there were almost no guidelines for creating extensions, which made it very hard to use them in combination sometimes, because every developer did it in another way - just because of missing guidelines.
I saw so many weird ideas for Yii2 extensions already, eg. using
Yii itself is so straight and clean. The next generation of extensions should follow its example.
PS: I don't think it makes sense to create an application with Gii. But Gii itself does not have to be limited to generating application related code.
What do you mean with "manage outside a complete project"?
The generator just generates temporary code which has to be pushed to a repo, but this is the same workflow, like you'd do it manually.
well, for me it's really more easy to develop and take care of the extension outside the project, as I normaly use my widgets in multiple smaller sites... so I try to keep application related "extensions" as modules... but thats just my own opinion... :) anyway i like the result as template, that I can then move outside to a "new" folder;)
I also think that an extension generator would be a great addition. Having developed quite a few extensions myself I must say that it would had been very useful to have a generator like this when I started with my first extension. There are quite a few good practices when it comes to developing extensions that many do not know about, especially those new to Yii.
As a side node; I also tend to develop my extensions under vendor now a days because I constantly keep improving my them during the development of larger projects.
Keywords don't save between preview and generate commands.
Have some enhancement issues: