PHP
  Home arrow PHP arrow Developing a URL Handling Helper Class 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

Developing a URL Handling Helper Class in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 7
    2009-08-03


    Table of Contents:
  • Developing a URL Handling Helper Class in PHP 5
  • Review: the previous TextHelper class
  • Building a URL-handling helper class
  • Putting the URL helper class into action

  • 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


    Developing a URL Handling Helper Class in PHP 5
    ( Page 1 of 4 )

    In this third installment of a series on building helpers in PHP 5, I will provide you with the basic pointers for building a URL-handling helper class. The code examples, though simple, should serve to demonstrate how to create a helper that generates dynamic URLs.

    Undeniably, helper classes are one of the most useful resources found in a PHP developer's toolbox. They present several distinctive characteristics that make them look quite different from a typical full-blown library: on the one hand, they're built as small packages of logically-related methods, while on the other hand their functionality may be so remarkable, that they become a fundamental block in the development of web applications.

    Fortunately, building helper classes with PHP 5 is a pretty straightforward process that can be tackled with only an average background in object-oriented programming. So, if you're a PHP developer who's searching for a friendly guide that shows you how to create different kinds of helpers through a hands-on approach, then this series of articles may be the material that you need.

    And now that you know what to expect from this group of tutorials, it's time to review the concepts that were deployed in the previous one. In that second part of the series I explained how to improve the use of a basic text helper class by declaring all of its methods static, with the exception of the constructor.

    In doing so, it was possible to take full advantage of the class without having to spawn any instances of it. Logically, a similar result can be obtained by declaring the class abstract, but as you know, abstract classes are intended to be inherited by children, while helpers generally aren't conceived that way.

    So far, so good. At this point, I've summarized the topics discussed in the last article, so it's time to talk about the subject of this one. Since it's a common practice to build helpers that manipulate URLs in different ways, in the next few lines I'm going to show you how to create a class whose main task will be dynamically generating URLs via a basic API.

    Want to learn how this brand new helper class will be developed? Then start reading right now!



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

       

    PHP ARTICLES

    - Adding Ordering and Grouping Clauses to the ...
    - 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...





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