mercredi 31 janvier 2018

Adding flags and switches to Artisan commands, Laravel 5.5+

I am fairly new to the command line but have successfully used php artisan make:command MyCommand. I have also added a command in a vendor package I've created.

What I'm not clear on is how to do things like this:

php artisan mypackage:mycommand -f --user="jhendrix@gmail.etc" --label "This is Jimmy Hendrix"

Where -f is a defined switch, and --user or --label are longer tags which take an argument in themselves.

In other words, how do I configure/map these options and flags, and how do I fetch them in my handle() function?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire