News Archive
PhpRiot Newsletter
Your Email Address:

More information

Evert Pot's Blog: Taking advantage of PHP namespaces with older code

Note: This article was originally published at PHPDeveloper on 2 February 2011.

Evert Pot has a quick post about a suggestion mentioned at PHPBenelux related to using namespaces with older code.

If you're running PHP 5.3 and you have to use pesky old code that uses long class prefixes (yea, so, pretty much all PHP code out there), you can still make use of namespace features to shorten them.

He includes a quick example that shows the shift from using the traditional Zend_Controller_Action_Helper_AutoComplete_Abstract to an aliasing with the use/as to just reference it as AutoComplete.