Results 1 to 5 of 5
Thread: Namespaces in PHP
-
09-27-2008, 02:03 PM #1Web Hosting Master
- Join Date
- Dec 2002
- Location
- The Shadows
- Posts
- 2,925
Namespaces in PHP
What do you guys think about namespaces being added to PHP. I personally cannot find any use for them in my coding, but I imagine it will be useful for some people.
Dan Sheppard ~ Freelance whatever
-
09-27-2008, 02:10 PM #2Web Hosting Master
- Join Date
- Jan 2006
- Location
- Athens, Greece
- Posts
- 1,481
The main reason is avoiding conflicts with various libraries integrated in to a project.
-
09-27-2008, 02:10 PM #3Web Hosting Master
- Join Date
- Aug 2003
- Location
- California, USA
- Posts
- 582
The main thing I see it being good for is things like the Zend framework, where you have class definitions like:
PHP Code:class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Resolver_Interface {
Personally, I probably won't have to use them. But I can definitely see a few frameworks taking it on, especially as people shift from PHP4 to the newer versions (It's hard to find a host without PHP5 at this point!)
-
09-27-2008, 02:12 PM #4Web Hosting Guru
- Join Date
- May 2008
- Location
- FL
- Posts
- 337
-
09-29-2008, 10:30 AM #5Junior Guru
- Join Date
- Aug 2001
- Location
- Central USA
- Posts
- 200
I probably won't personally use them, at least not at first. A good class naming convention like Zend uses already addresses this problem, and I have been using that already in my own class library and framework.
It may be helpful in some areas though, like naming Models and Controllers that aren't in the core library and don't really follow the directory naming convention. I could easily see using 'Zend::BlogController' instead of 'BlogController' as being very helpful.