Automatically Open Files on Artisan “Make” Commands
Published on by Paul Redmond
“Open on Make” is a neat little package by Andrew Huggins that makes it easy to have newly created files open in your editor of choice.
When you run commands like php artisan make:controller
, this package will listen for the command and open the file in the editor that you configure.
To configure your command to open in your editor of choice, you can configure the following environment variables, or publish the configuration:
OPEN_ON_MAKE_EDITOR=code# Optionally set some flags, i.e.OPEN_ON_MAKE_FLAGS="--reuse-window"
While writing about this, I opened a PR to disable the listener via configuration that was accepted yesterday.
The new open-on-make.enabled
configuration option allows you to explicitly disable the package in a given environment, or in cases where a team member cannot use it for whatever reason:
OPEN_ON_MAKE_ENABLED=false
Being able to disable the package will be helpful in a team setting where not everyone might not have the same preferences or if you have some other reason to disable it in a given environment.
To give this package a try in your project, head over to the GitHub repo or install it with composer require --dev ahuggins/open-on-make
.