PHP namespace hurdle

Pick Language to Auto Translate:
AR | BG | CA | CS | DA | DE | EL | ES | FI | FR | HI | HR | ID | IT | IW | JA | KO | LT | LV | NL | NO | PL | PT | RO | RU | SK | SR | SL | SV | TL | UK | VI | ZH | ZH-TW

PHP namespace has been added since 5.3 but only recently that many project start re-write to use PHP namespace.

I think the biggest hurdle is "class not found" when using a namespace, especially when using an autoloader. Most autoloaders do not aware of the namespace thus can't load the class.

It is most difficult when you have to go back to your existing code and adding code to call your class with a namespace, it is very time-consuming!

The best way to get around this is using PHP "Alias" then all your old class can be called the same way with minimum changes.

I have written a tiny namespace auto class loader that do just that. It call: NsClassLoader