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

Developing a URL Handling Helper Class in PHP 5

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.

TABLE OF CONTENTS:
  1. Developing a URL Handling Helper Class in PHP 5
  2. Review: the previous TextHelper class
  3. Building a URL-handling helper class
  4. Putting the URL helper class into action
By: Alejandro Gervasio
Rating: starstarstarstarstar / 9
August 03, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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
 

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: