Skip to main content
Home
Blog

Main navigation

  • Home
User account menu
  • Log in

Breadcrumb

  1. Home

PHP namespace hurdle

By ongetc , 9 February, 2017

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

Reseller hosting (free)

Hosting24 (w/ ssh)

A2 Hosting

Monthly archive

  • September 2009 (14)
  • October 2009 (11)
  • January 2010 (2)
  • June 2010 (3)
  • October 2011 (1)
  • March 2012 (1)
  • July 2012 (1)
  • February 2017 (564)
  • March 2017 (5)
  • April 2017 (2)

Pagination

  • 1
  • Next page

Popular content

Last viewed:

  • SPGM
  • Thufir
  • Viscacha
  • COLOURlovers
  • PHP namespace hurdle
  • Phorum
  • Open Journal Systems (OJS)
  • PHP FormMail Generator
  • Sphinx
  • ndCMS

User login

  • Reset your password