Using this article from Johannes Schluter as a starting point Vinu Thomas has worked up his own example of how the technique is used in the example on the Launchpad page.
This article is interesting because of the uses which come up when you can create custom Storage Engines using PHP. An interesting usecase for this is in creating test cases, where you can feed the data for a query from PHP and trap the activities on the database.
The example code defines methods for update, write and delete and the SQL to create the table and insert/manipulate rows is included (for a table created with "ENGINE=PHP").
On the PHP::Impact blog there's a recent post looking at using the popular unit testing PHP framework PHPUnit to test Zend Framework controllers.
Testing a Web application is a complex task, because a Web application is made of several layers of logic. Unit testing a Zend Framework controller can be very difficult, specially for those who are not familiar with the Zend Framework. You can test your action controllers using Zend_Test and/or PHPUnit. Zend_Test allows you to simulate requests, insert test data, inspect your application's output and generally verify your code is doing what it should be doing.
He opts for the second one and includes the directory structure you'll need to set up the tests, an example bootstrap file and a simple controller (AllTests). A simple test example is also included that checks a few things - if its the default action, the first action, parameter names and method names.
On the Experimentalworks blog a recent post looks at using DTrace, the powerful tool to debug and trace problems in an application, with your PHP applications.
Dtrace is really powerful and trying to do an introduction to all it's features is just not possible. Therefore I will just focus on the basics, that are needed to get our stuff working. The basic idea behind Dtrace is that the kernel and userland programs fire probes on a specific location in the kernel or the userland program.
He looks at the structure of a DTrace program as well as a list of probes that you can use to help track down the problem in your application. His "first example" traces the compile time of the app and, when run on the command line, returns the time in seconds.
On the ElectricToolBox.com blog there's a quick post looking at method chaining in a Zend Framework application:
Having used the Zend Framework on a couple of projects and spent a lot of time reading the documentation I discovered the use of method chaining. This post looks at how to use method chaining in PHP.
His examples include a comparison between a method-chained Zend_Mail example and a non-chained method with each line augmenting the same object over and over. He also includes the simple-as-pie method that lets you use chaining in your own applications - returning the object itself.
The NETTUTS.com site has an in-depth tutorial looking at the anatomy of a WordPress plugin:
WordPress is well known for its amazing collection of free plugins. There is one for almost every need you can think of, from backing up your WordPress installation to asking for a cup of coffee or fighting spam. But there are times when none of the available plugins seem to quite do the trick you are looking for. To help you in moments like that, this tutorial will guide you through every step of building a simple, widgetized WordPress plugin with settings.
They break it out into a few sections - the plugin template (files and directories), adding in the first functionality, making the widget for the plugin's output, add in a few settings and you're good to go. You can download the source if you want to dig right in and get going.
On the PHPBuilder.com site today there's a new tutorial talking about using PHP to dynamically create SVG images in a simple application.
As with many of the pages on my Web site, my SVG images are in fact generated by PHP scripts. I end up including many of the same images in other pages, but not always with the same size or colors, so making them customizable on a case-by-case basis is a useful thing. Attributes such as size, scale, colour, rotation, and position are obtained from arguments in the URL.
His example creates a SVG image using a class (UIControl) to create the content for the image. This content is dropped into the typical XML structure to display it. He also includes some extra attributes/methods you can use with the UIControl class to alter the resulting image.
Lorna Mitchell has posted an article to the Ibuildings blog looking at the Zend_Paginator component of the Zend Frameworks, some of her first impressions.
The idea of this module is to allow collections of data to be paginated. It takes the set, restricts the results, and can also generate the page numbers you need to move around between the resulting paginated data. Basically it saves me writing the same pagination code multiple times and then having to fix the bug where the last result on the previous page appears on the next ... all this has been thought of already.
She shows how it works with a simple example - paginating results from a database table, setting the count per page and the current page number. This object is pushed out to the view and rendered (in her case) via a Smarty template.
In a new entryKnut Urdalen looks at something that some PHP developers might have forgotten about - the return value of the include statement.
PHP never stops surprising me. I just found out that you're able to return values from the inclusion statements (require, require_once, include and include_once) through an example of Zend_Config.
His example puts an array of values inside the include file with a return statement. This script is included from another and, because of the return, the array data is passed back out into a waiting variable set equal to the include statement.
In a new tutorial from the IBM developerWorks site starts off a new series looking at creating some games, from start to finish.
PHP is an easy-to-use, easy-to-learn, widely accessible programming language. It's well suited for developing simple scripts you can use to help you in all kinds of games. Whether you play simple pen-and-paper games by yourself, complex tabletop role-playing games with a group of people, or online games of any kind, this series will have something for you. Each article in this "30 game scripts you can write in PHP" series will cover 10 scripts in 300 words or less (3d10 stands for "roll three 10-sided dice") simple enough for even a beginning developer, but useful enough for a seasoned game player.
The ten scripts they walk you through are things like a die roller, a name generator, a deck builder/shuffler, a poker dealer and a crossword helper.
David Otton has shared a discovery he's come across in his development - user-defined classes are not derived from stdClass.
Many OO languages have the concept of a single base class from which all other classes are explicitly or implicitly descended. For example, Ruby, Java and .NET all have Object. It's a very common belief that PHP implements stdClass as a base class for all objects, but this is in fact not the case.
He illustrates with a code example showing the results of calls to instanceof with a normal user class and one that extends the stdClass object.