Because the version 4 is a full API rewrites, and used namespaces, your old code cannot migrate without a little change.
We will try to explain how to do in few steps.
CLI
Begin first with the commands of CompatInfo in CLI mode.
JSON
How you can customize CompatInfo for all SAPI.
API
API are incompatible in versions 3 and 4. Here are code to do the same things.