The queue is given the command. The command has the functions I want to run, including the context and what I want done with the result. It can be a closure right up to a full class.
Using a framework like Laravel I can even "chain" queued commands - so CommandA will queued, then call CommandB when it is done etc.
I've never run into a situation that wasnt easily solved by this.
OK so what environment is the function being executed in? That environment is outside of PHP. Now when it comes time to do the callback, is the PHP thread still running, or not?