There is a lot I don't like about PHP, but one thing I love is multi-line strings:
$query = <<<EOT select field1 ,field2 ,field3 from tableName where field1 = 123 EOT;
What's cool about this, is that I can just copy SQL, that I've hand formatted (to my liking) from a querying tool (like dbeaver), and paste it (with formatting and all) directly into a php script, without worry about how line-breaks might corrupt the script.
I'm currently working on some small node.js projects and I'm very much missing this php feature.
The only think I can think to do, is to put my queries into a plain text file and import the formatted query from a file into the variable value. Then, later, when I need to modify the query, I can copy and paste to that file (pre-formatted) and then the script will just load my modifications next run.
I've read other post that have hacks for doing this type of thing in-script, but each solution doesn't match the ease and reliability of php's built-in support for such requirements.