php-hot-reloader
php-hot-reloader copied to clipboard
Allow bootstrap variables to be overwritten from outside file
Do you think it might make sense to change the variable declarations in the phrwatcher.php
bootstrap file:
$PROJECT_ROOT = __DIR__;
$WATCH = ["."];
// etc.
to
$PROJECT_ROOT = $PROJECT_ROOT ?? __DIR__;
$WATCH = $WATCH ?? ["."];
// etc.
to allow optionally declaring these variables somewhere else?
I'm currently trying to require this plugin inside another plugin on a site I'm working on, and it would be great if I could keep the original files from this repo intact to run composer update
without overwriting anything important.
Thats a fair point. So your ideia is require the original file instead of copy the original one, and then override or pass some variable, right?
I think a proper way of doing that is to expose a class for will which you can instantiate in your own file instead of use the phrwatcher.php
with hard coded variables.
So, you would create your own php file anywhere on your application, then a instance of the SSE Watcher (this new class with phpwatcher.php
behavior), and would point your HotReloader instance to this file instead.
What do you think?
Yeah, exactly.
I'm not sure I understand completely what you're planning, but as long as it's possible to set optional configuration variables from i.e a custom config.php
file instead of changing the code that's included in this repo, I think that's definitely an improvement! :~)