Using --gen php:autoload=1,namespace=1 won't work because the generated types don't have namespaces declared and the autoloader pulls in the individual files.
I've attached a simple patch from the latest SVN trunk that will do two things inside t_php_generator::generate_php_struct_definition:
- Append namespaces to the top of the file
- Use the non-backslash-prefixed namespace declaration for the autoloader key
I'm a little confused as to why there were even namespaces being written into the autoloader array at all when they were prefixed with a backslash, and __autoload receives class names without a leading backslash.