2011年7月6日星期三
Matthew Weier O'Phinney's Blog: Proxies in PHP
In a new blog post Matthew Weier O'Phinney has taken a look at proxy objects (the Proxy design pattern) and how it differs from some of the other popular patterns.
Of the other patterns mentioned, the one closest to the Proxy is the Decorator. In the case of a Decorator, the focus is on adding functionality to an existing object -- for instance, adding methods, processing input before delegating to the target object, or filtering the return of a method from a target object.
Proxies stand in for objects and have several benefits for your application that may or may not need all of the overhead a full object could cause. Matthew focuses on one benefit in particular - consuming and controlling access to another object. He sets up a problem of wanting to use properties/methods on objects that aren't exposed directly (like a protected method). His solution is a proxy layer class on top of the original object. He includes a few "gotchas" to look out for when using this technique including overwriting all necessary methods and copying over all of the needed properties.
Freek Lijten's Blog: Git commit hooks using PHP
In this new post from Freek Lijten he looks at a set of git commit hooks written in PHP for making things happen before, during and post commit.
Git hooks are usually found inside the .git/hooks folder of your git repository. Git tends to provide sample hook files there which are postfixed with a .sample extension. These examples are written as shell scripts. Take a look at them if you want, but today we're talking PHP!
He briefly touches on the types of hooks you can set up and includes two example scripts showing a pre-commit lint test for the changed files and a check during the commit on the message given for a certain standard (in their case, it must start with a three letter code).
2011年7月5日星期二
Voices of the ElePHPant: Interview with Nicholas Zographos
On the Voices of the ElePHPant podcast there's a new episode interviewing Nicholas Zographos, the head of the Pittsburgh PHP User Group.
Cal's three questions revolve around Nicholas' work with the group:
- How many members do you have at a meeting, on your mailing list and what do you do to bring those members closer together.
- What is your meeting structure?
- How do you handle the variety of skill levels in the group?
You can listen the usual three ways - either through the in-page player, by downloading the mp3
Ibuildings techPortal: DPC11: Day 2
The Ibuildings techPortal has posted the summary of Day 2 of the Dutch PHP Conference from Marco De Bortoli with some of his experiences from this year's event.
This year as part of the Ibuildings team I attended the Dutch PHP Conference for the first time. What can I say? Well, it was an unbelievable experience; I enjoyed every moment spent there. [...] There was also the high quality of the presented talks, but also for the great opportunity to spend good time with my colleagues at Ibuildings and people from other companies all around the world.
He mentions some talks specifically like Helgi's "First Class APIs", "Managing MySQL" by Thijs Feryn, a look at Modular Architecture from Kore Nordmann and Tobias Schlitt as well as David Zülke's map reduce session.
One thing I really appreciated about DPC was the Open Source and Open Knowledge spirit found there. Speakers were not there just only to talk and present something, they were there more to share their own knowledge and to share ideas and maybe a new solution to their problems. This, in my opinion, is one of the best things I took with me from DPC.
Nils Luxton's Blog: Installing PHP 5.4.0alpha1 into Wampserver
Nils Luxton has written up a guide you can follow to get the latest (non-production) release of PHP - v5.4.0alpha1 - up and running on your machine in your WampServer instance.
I wanted to do exactly that, and at work we use WampServer so we can easily switch between PHP versions (and it also makes enabling/disabling extensions and options very easy - if you develop on Windows, check it out). Assuming you have WampServer installed, it is fairly trivial to manually install new versions of the AMP trifecta.
There's a few things you'll need to download to get things up and running (besides the new PHP version) but the rest of the guide is simple configuration and startup. If all goes well, you should be running the alpha in less than ten minutes.