Replies: 3 comments 1 reply
-
I think that it would be great if this could be put into the core! |
Beta Was this translation helpful? Give feedback.
1 reply
-
I took the time and prepared a PR for this. It is currently in draft so feel free to have a look and give me feedback 😄 |
Beta Was this translation helpful? Give feedback.
0 replies
-
For everybody who likes the idea i have created a Package with all of the Features i mentioned in the PR: Laravel Console ToolkitIt supports
Feel free to try it out and give me Feedback. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Idea
Using properties in combination with Attributes to declare Arguments and Options on Artisan Commands.
Why?
The
$signature
method is a cool way to quickly define Arguments and Options for your Artisan commands, but it lacks types and isn't that intuitive. I often have to look in the docs to remember the exact syntax.The benefits of defining Arguments and Options as properties:
$signature
string has already quite a lot of features that need to be parsed. Also casting can be more easily implemented like in this Example .$signature
can exist in parallel so no old commands need to be changedThe downsides:
$signature
if you want)The Implementation
I already build a little Package that implement the Attribute syntax for Artisan commands. Have a look and try it here.
If you are curios and want to know more about the detailed syntax and how it could be working, i have written a detailed documentation where i go more into the details.
https://github.com/thettler/laravel-command-attribute-syntax
The Implementation would be a bit different of course.
❤️ Thank you very much for taking the time and reading this.
What do you think about the Idea and do you have any suggestions or different opinions? 😄☺️
I would happily create a PR for this Feature
Beta Was this translation helpful? Give feedback.
All reactions