The missing way of running tinker in Visual Studio Code
The missing way of running tinker in Visual Studio Code, inspired by Tinkerwell.
ð Looking for the ð Tinkerun Desktop App?
If you are creating awesome Laravel project with VSCode, you will never miss it.
ð Welcome! Let's start running tinker in Visual Studio Code.
Press CMD+Shift+p
then select Tinkerun: install
to active the extension to your Laravel project.
The Tinkerun: install
command will create a .tinkerun
folder in your project.
âââ .tinkerun
â âââ inspiring.php // the example code to run
â âââ tinkerun.json // the tinkerun config file
Open the file .tinkerun/inspiring.php
, you will see a green âķïļ play button in the upper right corner. Press it.
The play button read the config from .tinkerun/tinkerun.json
,
and open a tinker process with the config, then simulate to input the code from .tinkerun/inspiring.php
.
You are ready to Go :-) ð ð ð
Create PHP files in the .tinkerun
folder, and run it via green play button or shortcut CTRL+r
You can create lots of connections
{
"connections": [
// default connection config
{
"name": "dev",
"command": "php artisan tinker"
},
// you can also connect docker
{
"name": "docker",
"command": "sail tinker"
},
// and connect your ssh server
{
"name": "tinke.run",
"command": "ssh [email protected] -t 'cd /var/www/tinke.run/current && php artisan tinker;bash --login'"
}
]
}
then when you are running the PHP file under .tinkerun
folder. You will Pick a connection to run at first time.
The default shortcut is CTRL+r
, also you can bind yours:
Code -> Preferences -> Keyboard Shortcuts
tinkerun.run
commandPress Enter
in the Tinkerun result panel, and your missing Tinker back.
If the troubleshooting guides did not resolve the issue, please reach out to me by filing an issue, starting a GitHub discussion