Dispatch Laravel job on production server with Tinker 2


Sometimes you want to dispatch some jobs or run a command on the production server on the Laravel app, but sshing in the server is annoying and doesn't feel good.

Dispatch a Laravel job

So Tinker 2 can help you with this. Simple add it to your server list and dispatch the job using PHP code. In this example, I will use the real production app, because it's our real daily problem.


As your see, the job is dispatched and return 0 - successfully exit code.

Run a command with streaming output

Sometimes you want to run a command and see the progressing output from it, you can enable the stream output mode of Tinker 2, by toggling the status-online icon in the status bar of Tinker 2.

To do this, we'll use passthru function of PHP

stream output laravel command

Thank you for reading, we'll write more blog posts about use-cases for Tinker 2.