Basically Iterators provide a list interface for an object. Like all interfaces they are a contract how something can be used. If you use an interface it is not relevant how it is implemented - the implementation logic is encapsulated.
It is of course relevant on the integration level. A bad implementation can impact the performance of you application. Even an good implementation may need special resources (like a database). But all this does not impact how you use it. Your code using the object with the...
If you've done any work with PHP frameworks, the concept of a "front controller" should be a familiar one. If you haven't, the idea might be new to you and PHPMaster.com has started off a series that will introduce you to the basics of the Front Controller design pattern in a few different parts.Some are now grumbling about newer concepts that have recently made inroads in day-to-day PHP development, saying Front Controllers are a redundant "reinvention of the wheel" which should be discarded ipso facto....
The Developer Drive site has a new post with a few beginner suggestions about how to do some error reporting in your applications:As much as programmers attempt to anticipate every possible action or combination of actions that a user can take when encountering a web application, no one can foresee them all. When the user takes an unanticipated course of action and "breaks" the application, the software needs to catch them before they fall.They show you a few methods for handling the errors that might...
The Voices of the ElePHPant podcast has released its latest episode - an interview with Rafael Dohms of the Amsterdam PHP user group.Cal's three questions for Rafael about his involvement in the community:
Tell us about your experience integrating with a whole new community when you moved from Brazil to Amsterdam
Talk to us about Amsterdam PHP
Talk some about how the leadership of the user group is set up ("enablers")
You can listen to this latest episode either through the in-page player, by downloading...
Thomas Weinert has posted a helpful hint for those developing their PHP applications in a Windows environment - how you can use the PHP 5.4 built-in webserver to test your applications.PHP 5.4 has an built-in webserver. For local development it is not necessary to install Apache Httpd or another webserver anymore. You can just start an server from the command line. [...] To make things a little easier you can create a windows shortcut.He shows what it looks like running in a console and steps you through...
In a recent post to his blog Anthony Ferrara takes a look at what he calls the "Framework Fixation" anit-pattern - that one of the first inclinations he sees is to use a framework when it may not be needed.In this day in age, it seems that the community trend is completely and unequivocally trending towards the use of web application frameworks. So much so that the defacto first comment to someone asking how to do something seems to be "Just use a framework, and it'll solve the problem for you." While I...
In his latest post Matthew Weier O'Phinney introduces you to the new init() method in the Zend Framework 2 controllers and how it differs from the one in version 1.In Zend Framework 1, controller's had an init() method, which was called after the controller was instantiated. The reason for it was to encourage developers not to override the constructor, and thus potentially break some of the functionality (as a number of objects were injected via the constructor). init() was useful for doing additional...
Latest PECL Releases:
The last blog post was just notes on the feedback I got as a reaction to a moment of frustration on twitter. People had asked me to summarize the feedback and this is what I did in that blog post. But I realize now what is more relevant is that the CMF team needs to more clearly explain that we are not trying to go head on against the likes of Drupal, Typo3 or ezPublish but why our work still might matter for to others. The people that are interested in the CMF are developers that have realized that...
Creating forms in Zend Framework (ZF) is easy, but creating and managing complex forms can get messy! Using config files is perfectly good if you use standard Zend Form elements; it is quick and easy to setup a form in a few minutes however you will have limited control over how the form is rendered. If you want to display your own custom form element correctly in Zend Framework then some configuration is needed in order to achieve this with a config file. An alternative approach is to create some custom...
For those who haven't been following the Midgard-land, there have been some interesting developments recently. The long-term supported Ragnaroek branch of Midgard1 is slowly fading away, and much of the recent activity has focused on making Midgard2 available via the PHPCR standard, and on the new Create.js inline editing tool.
At the same time the installation story of Midgard2 has greatly improved, with for instance Ubuntu 12.04 LTS providing it straight from the distribution's package repositories....
Starting a server from the command line
PHP 5.4 has an built-in webserver. For local development it is not necessary to install Apache Httpd or another webserver anymore. You can just start an server from the command line.
Change the directory to your project directory. The argument -S starts the webserver. You need to specify a host and a port. All requests are shown in the console window.
To make things a little easier you can create a windows shortcut. This allows you to change the...
So the other day I was ranting on twitter that there are very few contributors for Symfony CMF. Actually I should qualify this. Surprisingly we have quite a few people helping on the low level architecture pieces like PHPCR. For the inline editing the IKS project is ensuring a healthy doze of development pushing [create.js http:://createjs.org] etc. But on the Bundle level there is very little happening. This to me is quite puzzeling since thanks to our sandbox and the fact that PHPCR ODM for the most...
In Zend Framework 1, controller's had an init()
method, which was called after the controller was instantiated. The
reason for it was to encourage developers not to override the
constructor, and thus potentially break some of the functionality
(as a number of objects were injected via the constructor).
init() was useful for doing additional object
class MyController extends Zend_Controller_Action
public function init()
// do some stuff!
But this feature is missing from ZF2;...
On the Symfony blog there's a new post from Bernhard Schussek about some of the changes that have happened in the Forms component of the Symfony 2 framework (in version 2.1).Those of you who already upgraded to Symfony 2.1 Beta probably noticed that the new version comes with many backwards compatibility breaks in the Form component. Many of you probably ask yourselves: Why? The simple answer is that the Form component is one of the most complex components in Symfony at all.They list out some of the...
Since you can't always be online when you need to install new libraries you'll need for your PHP work, Lorna Mitchell has posted a quick guide to downloading and installing PEAR packages when you're offline.As with most tools that work really well, I know very little about PEAR. I mean, I use it all the time, and I love it for getting all the extensions installed that I need for the work I do. [...] However I'm now in a situation where I might need to install PEAR packages with a connection that may or...
In this new tutorial to the TrueLogic.org site, they show you how to use the Mailchimp (using a library) from your application.For those unfamiliar with Mailchimp it is an online service for handling subscribers and newsletters. It is mainly used to handle subscription lists and sending newsletters via its Mailchimp API which has wrappers and integration features for various languages/platforms. [...] In this article we will take a quick look at how to integrate this with your PHP application. If you...
Rafael Dohms has started up a new project that wants to help developers get help on their broken code via collaboration with others - FixThatCode.com.Coding is an art. There are many ways to paint an apple, but which is better? Most of the code we write everyday can be written in better ways to achieve different objectives. Sometimes all it takes is a fresh pair of eyes. Code quality can be observed through various identifying markers. Perhaps you're not aware of them, don't have time to look for them or...
Nikita Popov has a new post to his site looking at how you can add your own syntactic features directly to PHP (requires knowledge of the C language).Several people have recently asked me where you should start if you want to add some new (syntactic) feature to PHP. As I'm not aware of any existing tutorials on that matter, I'll try to illustrate the whole process in the following. At the same time this is a general introduction to the workings of the Zend Engine. So upfront: I apologize for this overly...