To send a command from the terminal of the host machine to the Docker container in Larave Sail, you just have to use the sail command, it works better if you already setup an alias for the sail command, let me show you how

CREATE ALIAS for vendor sail
$ alias sail='bash vendor/bin/sail'

Now you can execute any sail command to the contairner from the host machine:

$ sail php --version

Short and sweet!