Is there any way to test php code the same way a compile phase does in other languages to catch obvious mistakes from hitting your users?

PHP Static Analysis Tool (https://github.com/phpstan/phpstan) is pretty good at surfacing that kind of thing.

Phan (https://github.com/phan/phan) is another one.

Other potentially useful tools:

- PHP_CodeSniffer (https://github.com/squizlabs/PHP_CodeSniffer)

- GrumPHP (https://github.com/phpro/grumphp)

- PHP Mess Detector (https://phpmd.org/)

There's also Vimeo's Psalm [0].

[0]: https://github.com/vimeo/psalm