Artisan make:class to make a regular PHP class #41324
Replies: 6 comments 11 replies
-
What is the benefit over just making a class manually? I'll tell you based off of historical PRs, something like this would have a very low chance of getting merged. |
Beta Was this translation helpful? Give feedback.
-
Also considering make:trait and make:contract |
Beta Was this translation helpful? Give feedback.
-
So this conversation has been progressing in several different places (slack, twitter, and here). We can have the make command be customizable and use a config and the stubs dir to add any make:whatever. In addition to this we should add to the framework |
Beta Was this translation helpful? Give feedback.
-
I'm not entirely opposed to this. My gut feeling on the commands would be something like: make:class
make:class --action
make:class --invokable
make:contract
make:trait Regarding |
Beta Was this translation helpful? Give feedback.
-
I love this idea. I've never contributed to Laravel before, so I started with the simplest one. Could someone give me some feedback on this? If I'm doing this right, I'd be happy to work on the other suggestions as well. |
Beta Was this translation helpful? Give feedback.
-
If I could throw in my 2 cents, I really would like an easy way to create Services and Actions using artisan make commands. I know they are more of an "unofficial" standard from what I understand but I think they are used enough to deserve to be made first class concepts. I get that especially Services are somewhat vague, but I think that's sort of the point, Its a convention for storing plain PHP classes with logic that don't fit well in existing Laravel concepts. But I wonder if it would not be better and more flexible to allow for custom make commands easily. Sure you could write a custom make command, but what if for simple things that require no custom arguments, could there not be a generic The way I imagine is if it does not find a matching command class for a given command name, but the command name starts with So that if I make a file I think keeping it arbitrary and extensible would be the most generally useful way to move forward with a PR that provides for the most value for the additional framework code. |
Beta Was this translation helpful? Give feedback.
-
So what do y'all think about a command like make:class to make a plain php class?
Also where would the resulting output go to by default?
Models?
Beta Was this translation helpful? Give feedback.
All reactions