Sorting out commands and Docker info
Closed this issue · 2 comments
Laravel Zero has you make your own command, so to my knowledge, you aren't building php artisan...
commands, but instead your own self-contained binary (e.g. fly-laravel
).
This project's command is simply application
right now (bc of this file: :https://github.com/fly-apps/fly-laravel/blob/main/application ).
So, you'd run commands in development like this:
./application list
./application launch
Note that we see all our commands available here:
You can rename that via ./application app:rename <foo>
(see here: https://laravel-zero.com/docs/installation )
After renaming it, you can then do things like:
# If we renamed it "fly-laravel"
./fly-laravel list
The thing that builds it "for production" is
# or whatever you re-named it to
./application app:build
Registering the command
You shouldn't need to register a command with a service provider because this project itself produces a binary that creates the command.
The trick, then, is to setup the project in a way that gets Composer to add the binary to ./vendor/bin
when installed in a Laravel project or ~/.composer/vendor/bin
if installed globally on someones machine.
To my knowledge, this is how: https://laravel-zero.com/docs/build-a-standalone-application
(I haven't done that process yet myself in my own projects to see!)
Docker Stuff
The Dockerfile
references Octane - those files are built into the base Docker image, in this repo: https://github.com/fly-apps/laravel-docker
So, apparently the fly-laravel command is already added in ./vendor/bin. I'll suggest the user can add a shell alias for it in the readme.