LogoPhly, boy, phly
the weblog and site of Matthew Weier O'Phinney

Thursday, April 28. 2005

Cgiapp Plugin Development

I've been working on the Cgiapp roadmap, and particularly on the plugin architecture. I'd been operating under the assumption that I'd have to make a PHP5-specific release (Cgiapp2) to allow this feature. However, it turns out I'm wrong.

PHP has had overload functionality since PHP4, and it has been in the standard build since 4.3.0. It turns out that the only things I had to do differently to get plugins working in PHP4 (which work via the __call() magic overloading method) were to turn on overloading for the function (via the overload() function, if available), and to look for a global $CGIAPP_PLUGINS variable (rather than a class static).

In doing so, I started evaluating the need for Cgiapp2.

It turns out I can do a large amount of what I'd planned for my Cgiapp2 roadmap in PHP4... which largely eliminates the need for Cgiapp2. However, there are a few things which I can do more gracefully or better using PHP5 techniques -- such as testing for errors in the run mode, and overloading.

My decision is to create a separate class, Cgiapp5, which inherits from Cgiapp and overrides methods as necessary. Currently, it unsets the $CGIAPP_PLUGINS variable (as unnecessary), overrides the run() method (to use exception handling instead of PHP's error handling), and overrides the __call() method (to use the class static property instead of the global variable). The unit tests so far show both versions as working and compatible.

What I like about this pattern of development is that I can add some powerful features now for PHP4 users -- who will be, for some time, I'm certain, the largest base of users, until PHP5 gains momentum. But, simultaneously, I can work with the more dynamic developments of PHP5 without sacrificing backwards compatability.

The downside is that there's little incentive for developers to write for Cgiapp5 instead of Cgiapp -- and that's the future. However, at this point, I want to aim for more developers than fewer.

Leave a comment and let me know what direction Cgiapp should take.

Posted by Matthew Weier O'Phinney in PHP at 22:59 | Comment (1) | Trackbacks (0)

Trackbacks
Trackback specific URI for this entry

No Trackbacks

Comments
Display comments as (Linear | Threaded)

hey i have been using cgi::app alot in my projects, and have created my own framework around it, using quickform and savant. I am curious though to see what your idea of creating 'plugins' for the system would be, as I know you have used cgi::app from the perl days. Even something unfinished would be cool to see. thanks.
#1 kenrick buchanan (Link) on 2005-05-11 11:35 (Reply)

Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

 
 
  • Home
  • Resume
  • Blog
  • Phly PEAR Channel
  • Contact Me
  • About this site

ZCE

Zend Education Advisory Board Member

Add to Technorati Favorites

Calendar

Back September '08 Forward
Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          

Quicksearch

Links

  • PHLY - PHp LibrarY
  • Paul M. Jones
  • Mike Naberezny
  • Shahar Evron
  • Planet PHP
  • Zend Where I now work
  • Garden.org Where I once worked

Archives

September 2008
August 2008
July 2008
Recent...
Older...

Categories

XML Linux
XML Personal
XML Aikido
XML Family
XML Programming
XML Dojo
XML Perl
XML PHP

All categories

Syndicate This Blog

XML RSS 0.91 feed
XML RSS 1.0 feed
XML RSS 2.0 feed
ATOM/XML ATOM 0.3 feed
ATOM/XML ATOM 1.0 feed
XML RSS 2.0 Comments

Show tagged entries

xml best practices
xml books
xml conferences
xml dojo
xml dpc08
xml file_fortune
xml linux
xml mvc
xml pear
xml personal
xml php
xml programming
xml ubuntu
xml webinar
xml zendcon
xml zend framework
© 2004 - present, Matthew Weier O'Phinney
matthew-web <at> weierophinney.net