The IBM developerWorks site has a new article posted that talks about design patterns, five of them in particular, that can help to “accelerate your PHP development” and make your code more maintainable down the line.
As an application developer, you can have a lifelong career without ever knowing what any of the patterns are called or how or when they’re used. However, I’ve found that a good working knowledge of these patterns, as well as those introduced in the developerWorks article “Five common PHP design patterns” (see Resources), allows you to do two things: Enable high-bandwidth conversations and reduce painful lessons.
The patterns they talk about in this “five more” article of the series are:
- Adapter Pattern
- Iterator Pattern
- Decorator Pattern
- Delegate Pattern
- State Pattern
Diagrams are provided for each of them, showing how they flow along with brief code examples (structures really) to show how that transitions over to actual use.
Padraic Brady has pointed out the “new kid in town” when it comes to magazines about PHP – Enterprise PHP:
There is a new PHP magazine called “Enterprise PHP” available in English, German and French which might even console those missing the apparently ill-fated International PHP Magazine. Back before publication the usual tree of suspects led me to being interviewed for the initial edition published a short while back.
The current issue (which you can get for free after a survey) has articles looking at testing your PHP scripts, how “professional” it is to use PHP and the fact that Java is not PHP (wait, isn’t that backwards?)
In a new post, Greg Beaver talks about a few things, the main one being a new release of the phar extension he’s made – phar version 2.0.0a1 – a reworking of the previous functionality with loads of new features including:
- Phar now supports tar and zip archives with the same API that is supports phar archives.
- Phar has a front controller for web applications that fully handles MIME types, supports mod_rewrite-like functionality with far more flexibility
- Phar supports phar:// stream wrappers in include_path for PHP 5.2+
- Phar supports creation and modification of data-only tar and zip archives (no executable phar stub) via the PharData class.
There’ve also been updates to the manual for the project to reflect this new version of its API. You can download this latest version here: source or Windows DLL.
On the ThinkPHP blog today, Ute has posted about a developer blog that has been started up for PHProjekt:
Seven and half years and a lot of downloads later the development team decided that a complete makeover is necessary not only to include more Web 2.0 features but also to add new functions to one of the most popular Open Source Groupware based on PHP. [...] There are still some months left till PHProjekt 6 will be released but for the time being you can follow the progress in a developers’ blog started recently.
The blog already has information on the upcoming version (PHProjekt 6) and a first part of a “what’s new” series on additions to the project. PHProject is an open source groupware application providing tools like shared calendars, project management and file management.
Jacques Marneweck points out a tutorial he came across showing how to perform an installation of the PEAR library system on a shared host.
This is quite useful when you are forced into using a clueless shared host who only have the bare PEAR installation on their servers, and have not ever considered installing DB, Mail, Net_SMTP, etc. which lots of people use instead of reinventing the wheel with each project.
The steps of the tutorial are pretty simple and they include two different ways – installing it to your docroot directory if the web host already has the pear binary set up or using ftp/ftps/sftp to upload and install the needed files.
Matthew Turland is looking to “save you some grief” by pointing out an issue he recently had trouble with and eventually found out was a bug in PHP.
It’s pretty rare that I encounter a bug in the software I run that hampers my ability to work or my server environment’s ability to function normally. However, I encountered one last week that has taken me and several Rackspace support technicians nearly a week to figure out, namely PHP bug #43677.
The issue was that PHP seemed to be “forgetting” the include_path in the current script (not Apache). The bug has been found in PHP 5.2.5 (and possible in all of the 5.2.x releases as well). The problem has been fixed in the latest CVS version and a patch has been created for those that want to correct the problem right away.
DevShed has continued their series (here’s part one) looking at the use of file uploading in your PHP scripts. They build on that foundation and add in some more useful features this time:
The initial script in the first tutorial of this series lacked some important features, such as the implementation of an effective error handling module and the ability to check the MIME type and size of the file being uploaded. In this second installment of the series, I’m going to improve the logic of the script from the first tutorial to provide it with the capacity to retrieve useful information concerning the entire file uploading process.
They look back at the previous tutorial to remind you of some of the concepts and then move on to show you how to get information about the file (like the MIME type, name and size of the uploaded file). The last page is just the full source code for the cut and pasters out there.
Stefan Mischook has posted the second part of the video tutorial introduction to making a Zend Framework application:
This Zend Framework video is from our resident Zend-nerd: Jon Lebensold. Again, let us know what you think and should you have any suggestions or request, please feel free to comment.
Part one was posted back on Tuesday for those that need to catch up.