How to autoload, so composer packages work correctly?
Call to undefined function PHPEncryptData\mcrypt_get_key_size()


mcrypt is a php function of the mcrypt extension. Autloading is working perfectly fine, or you wouldn't get that far. You're simply missing that extension.

The error message is a bit confusing because PHP always looks for functions in the global namespace and in the namespace the code is in and then prints the error for the one with the namespace.