Closed innocenzi closed 1 year ago
@huangdijia feel free to tell me what you think is wrong with this pull request 👍
EDIT: this comment was because the PR had a thumb down, but they removed it.
Thanks for your pull request to Laravel!
Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.
If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!
If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.
I think having the ability to pass a file to Tinker has a useful potential, not only for my use case (which is pretty niche — my screenshot is also not the best example, since I could run the test directly, but I'd rather press F5 in my IDE to execute code than open Tinkerwell or a terminal).
I'll just use php artisan tinker --execute $(sed 's/<?php//g' <$fullFileName)
then.
This pull request adds support for a
--file
option that takes the code from the given file and executes it, similar to--execute
.My use case for this was setting up Code Runner and wanting to be able to run it in my Laravel application context, instead of just PHP. For this, the following configuration is required: