With a bit of pushing and prodding I got YAK Pro PO working with Maven, here's how. Below is the basic layout for the project directory structure, the main directory is where all PHP source code is. That directory can have sub-directories too. The resources directory contains my yakpro-po.cnf file, which holds configuration for YAK Pro PO. The target directory is where the context and obfuscated files will appear.
Before I got started, I had to clone YAK Pro PO from Git, and get the PHP-Parser that it relies on. That is done via the following commands:
Then I had to add some properties to my pom.xml file as below. Adjust the path to the php executable and the path to where you cloned YAK Pro PO.
To run YAK Pro PO I used the exec-maven-plugin and configured it with the properties from above as well as assumed directories from the project directory structure outlined at the start of this article. This is what the plugin configuration looks like...
Then to run, I just need to do:
I have a few more plugins configured in my particular setup that takes these obfuscated files and packages them in a distribution ZIP as well as deploys the code to my web test server, but that's outside the scope of this article.
Don't forget to adjust the configuration file for your needs. The default didn't work for me and I had to tweak settings until I got output that was obfuscated but would still run as usual.