Home arrow PHP arrow Enhancing a URL Handling Helper Class in PHP 5

Enhancing a URL Handling Helper Class in PHP 5

Are you a PHP developer wishing to find an approachable guide that walks you through building different kinds of helper classes in PHP 5? Then look no further, because this group of articles may be the material that you really need.

TABLE OF CONTENTS:
  1. Enhancing a URL Handling Helper Class in PHP 5
  2. Review: generating dynamic URLs simply
  3. Declaring the methods of the URL helper class static
  4. Putting the new URL helper class in action
By: Alejandro Gervasio
Rating: starstarstarstarstar / 3
August 10, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Welcome to the fourth part of a series on building helpers in PHP 5. Comprised of eight tutorials, this series shows how to create some of the most common types of helper classes found in many popular PHP frameworks, and it complements the corresponding theoretical concepts with numerous code samples.

Having already outlined the goal of this set of articles, now it's time to review the topics that were treated in the last one, so you can see how they'll link with the subject of this fourth tutorial. In that specific article I went through the development of a basic URL-handling helper class, whose methods behaved in most cases as simple wrappers for some of the values available in the native $_SERVER superblobal PHP array.

While it's fair to say that the structure and logic implemented by this helper class was rather rudimentary, it's worth stressing that it demonstrated how to build a URL helper class in PHP 5 in a straightforward fashion.

Of course, the class in question is susceptible to being enhanced, and that's precisely what I'm going to do in the next few lines. You might be wondering how. Well, as you'll possibly recall, all of the methods of the class were called initially inside the object context, that is dynamically, which may lead to the creation of an unnecessary instance of the helper class.

So, to solve this issue quickly, in this chapter of the series I'm going to redefine the signature of the previous URL helper class by declaring all of its methods static. Thus the question now is: are you ready to learn the full details of how this will be accomplished? Then don't waste more time; start reading right now!



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: