PHP

Zend Framework version 1.5 officially released

The Zend Framework has always been my favorite PHP framework. The thing I love about this framework is that its components are loosely coupled. That is to say that its components have well-defined, and well-thought out dependencies. If you don’t like certain components, you don’t have to use them. Other frameworks boast this kind of modularity, but honestly I haven’t seen any that really back it up. For our last two or three PHP projects, we gave CakePHP a try. At first I was really happy with cake because of how quickly I was able to wire frame an application, but the more I use it the more I realize that the components in cake are far too coupled and there is just too damn much “auto-magic” going on in cake. I really prefer explicit to implicit code.

The reason we decided to leave Zend and go to CakePHP was because it lacked two main components that made it very difficult to wire frame applications quickly and easily. Those components are a layout system, and a form manager. I am happy to announce that Zend has tackled both of these problems in this release, and has actually done a decent job on them. Neither of them are 100% yet (at least not in my opinion), but both are very usable and helpful at the very least. Go grab a copy of the new release and give it a go. I think you’ll be quite happy with it!

For a full list of the new features, check out the official release page on zend developer zone.0

UPDATE! - Zend Developer Zone has published a webinar on Zend_View and Zend_Layout by Ralph Schindler. Go check it out!

PHP CSV Utilities v0.2 released - now able to detect the format of a csv file

Download PHP CSV Utililties v0.2
Read Documentation for PHP CSV Utilities

I have just wrapped up version 0.2 of our csv library. It includes several new features. The most exciting of which is the new Csv_Sniffer class.

(more…)

Cut down on temporary variables in PHP with Fluidics

Ollie Saunders, a colleague of mine and a regular at the DevNetwork forums has put together a very slick little set of functions he has collectively termed “PHP Fluidics”. If there is one thing that really sucks about PHP, it’s how often you have to use temporary variables to get to methods or array elements you need. Fluidics makes this process (and several others) much easier. We use this library in just about everything we code these days and I’d like to point out a few reasons why.

(more…)

PHP CSV Utilities - a PHP library similar to python’s standard CSV module

Download PHP Csv Utilities

PHP Csv Utilities Documentation (PhpDocumentor)

Since I began doing web development five years ago, I have been exclusively a PHP developer. Recently though, I have taken quite a liking to python. In fact many times while I’m writing PHP I find myself thinking, “It sure would be nice if I could do this the python way”. It’s not that I don’t love PHP, it’s just that python is such an absolute joy to work with. Many features of PHP feel sort of tacked-on as an afterthought. For instance, many standard features available for object-oriented languages are rudimentary or missing completely. Although to PHP’s credit, PHP5 and the new Zend engine 2 have improved the situation considerably.

Several of the recent projects I’ve been working on have required an “import from / export to CSV” feature. PHP comes with a few functions for reading and writing csv files right out of the box: fgetcsv and fputcsv. While these are good functions and they get the job done I find they just aren’t enough in many cases. It would be nice if PHP had an interface like python’s csv module. Enter PHP CSV Utilities. The library is still in its infancy and nothing about the interface is concrete yet, but here are some of the things that are already possible with the library:

(more…)

HTML Purifier 3.0.0 released

If you have ever used bbcode or any other non-html markup language in an attempt to avoid having to filter user-submitted HTML, those days are over. HTML Purifier is a standards-compliant html filter. This means that not only does it protect your website from security risks such as cross-site scripting attacks, but it also produces completely valid (x)html. It is also character-encoding aware. With this release, the author, Edward Z. Yang has decided to GoPHP5, so don’t expect to see this version released for PHP4 (The 2.1.x branch will be maintained until PHP 4 is completely deprecated, but no new features will be added to it.).

This release a number of improvements in CSS handling, including the filter HTMLPurifier_Filter_ExtractStyleBlocks which integrates HTML Purifier with CSSTidy for cleaning style sheets (see the source code file for more information on usage), contains experimental support for proprietary CSS properties with %CSS.Proprietary, case-insensitive CSS properties, and more lenient hexadecimal color codes. Also, all code has been upgraded to full PHP 5 and is E_STRICT clean for all versions of PHP 5 (including the 5.0 series, which previously had parse-time errors).

For more details about the release, check out HTML Purifier’s website.

$_SERVER['PHP_SELF'] can not be trusted, but there are safe alternatives

I spend a good deal of time reading about PHP security over at the PHP Developer’s Network forums. In one of the many discussions I have had over there, I recall one in particular that really opened my eyes to how easy it can be to overlook a very serious security issue. As you may know, there is a predefined array of server-related variables in PHP, aptly named $_SERVER. For years I used a certain element “PHP_SELF” within this array in instances where I needed to output what page I was currently working within. One of the most common of such instances is when you need to tell a form to post back to itself (a very common practice in PHP).
(more…)