PHP
  Home arrow PHP arrow Using Aliases and the Autoload Function with Namespaces in PHP 5
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Using Aliases and the Autoload Function with Namespaces in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 3
    2008-12-03


    Table of Contents:
  • Using Aliases and the Autoload Function with Namespaces in PHP 5
  • Review: the use keyword
  • Utilizing namespace aliases
  • Autoloading classes and working with custom functions

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Using Aliases and the Autoload Function with Namespaces in PHP 5
    ( Page 1 of 4 )

    Namespaces are an elegant approach to solving naming conflicts between the classes that are used by a PHP application. Indeed, it’s pretty common to suffer this problem during the development of a project that’s been charged to several programmers, and also when working with third-party libraries. This four-part series of articles, of which this is the last, shows you how to handle namespaces.

    Introduction

    Hopefully, the introduction of PHP 5.3 will contribute to fixing these issues, since it will incorporate support for namespaces. In the meantime, as you wait for its  release, you may want to take a close look at this group of articles, which will walk you through the basics of using namespaces with PHP 5 by way of a hands-on approach.

    And speaking of hands-on approaches, you’ll possibly recall that in the previous article of this series, I explained by means of distinct practical examples how to utilize the “use” PHP keyword to tie a couple of sample classes to different namespaces. Of course, one of the most important benefits in using this reserved word is that it requires a shorter syntax for declaring and utilizing a certain namespace. This approach appeals to many programmers.

    It's worth noting, though, that PHP 5.3 will let you use yet another notation that can be quite helpful when it comes to declaring namespaces in a more intuitive way. In this specific case, I’m talking about the ability to work with aliases, that is, meaningful words that can be directly linked to a given namespace.

    If you’re interested in learning how to use aliases when working with namespaces, in this article I’ll be taking a close look at this topic, so you can learn quickly how to put this feature to work for you.

    Now, it’s time to get rid of the preliminaries, and start discovering the real power in using namespace aliases with PHP 5. Let’s get going!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek