I have not had a chance to look at integrating PsySH settings for this directly with drush settings yet. Hopefully sometime
soon I will open a pull request to integrate shell settings with drush better. So for now, I just use the config file functionality
that comes bundled with PsySH to add a config file. See here for more details.
All we need to do is create a file at ~/.config/psysh/config.php. As you can see from the extension,
this is just a PHP file, so we can add whatever logic in here we need.
I crudely detect if this is being run through drush by checking for the drush_drupal_major_version function. If it
exists (and therefore drush has been bootstrapped) I add my drush specific file based on Drupal version.
Here is my config.php file:
From the sample config code above, you can see that I assume my drupal specific files will be in the ~/.config/psysh/includes/ directory.
So there should be a structure like…
And finally, here is a breakdown of things I add to my Drupal 8 (drupal-8.php) file, as an example:
Hopefully this helps give you some ideas about helpful things to help make using
the drush shell easier.