Blog Posts

Creating Re-Usable Zend_Application Resource Plugins

In my last article, I wrote about how to get started with Zend_Application, including some information about how to write resource methods, as well as listing available resource plugins. What happens when you need a re-usable resource for which there is no existing plugin shipped? Why, write your own, of course!

All plugins in Zend Framework follow a common pattern. Basically, you group plugins under a common directory, with a common class prefix, and then notify the pluggable class of their location.

For this post, let's consider that you may want a resource plugin to do the following:

  • Set the view doctype
  • Set the default page title and title separator

Continue reading...

Quick Start to Zend_Application_Bootstrap

We added Zend_Application to Zend Framework starting in version 1.8.0. The intent behind the component was to formalize the application bootstrapping process, and provide a simplified, configuration-driven mechanism for it.

Zend_Application works in conjunction with Zend_Application_Bootstrap, which, as you might guess from its name, is what really does the bulk of the work for bootstrapping your application. It allows you to utilize plugin bootstrap resources, or define local bootstrap resources as class methods. The former allow for re-usability, and the latter for application-specific initialization and configuration.

Additionally, Zend_Application_Bootstrap provides for dependency tracking (i.e., if one resource depends on another, you can ensure that that other resource will be executed first), and acts as a repository for initialized resources. This means that once a resource has been bootstrapped, you can retrieve it later from the bootstrap itself.

Continue reading...

Real-time ZF Monitoring via Zend Server

When keeping tabs on your ZF applications, it's often difficult to separate application errors from general PHP errors, and if you aggregate them in the same location as your web server errors, this can become more difficult still.

Additionally, PHP's error reporting doesn't provide a ton of context, even when reporting uncaught exceptions — typically you'll only get a cryptic exception message, and what file and line emitted it.

Zend Server's Monitor extension has some capabilities for providing more context, and does much of this by default: request and environment settings available when the error was logged, the function name and arguments provided, and a full backtrace are available for you to inspect. Additionally, the Monitor extension includes an API that allows you to trigger custom Monitor events, and you can provide additional context when doing so — such as passing objects or arrays that may help provide context when debugging.

Continue reading...

Building RESTful Services with Zend Framework

As a followup to my previous post, I now turn to RESTful web services. I originally encountered the term when attending php|tropics in 2005, where George Schlossnaggle likened it to simple GET and POST requests. Since then, the architectural style — and developer understanding of the architectural style — has improved a bit, and a more solid definition can be made.

Continue reading...

Exposing Service APIs via Zend Framework

The hubbub surrounding "Web 2.0" is around sharing data. In the early iterations, the focus was on "mashups" — consuming existing public APIs in order to mix and match data in unique ways. Now, more often than not, I'm hearing more about exposing services for others to consume. Zend Framework makes this latter trivially easy via its various server classes.

Continue reading...

Speaking at ZendCon 2009

It's probably already a foregone conclusion, but I'm speaking once again at ZendCon this year — one week from today!

Continue reading...

Why UnCons are Important

My good friend, Keith Casey, is once again chairing Zendcon's UnCon. For those who have never attended, it's basically one or more tracks running parallel to the main conference, but with content pitched by attendees — sometimes presented by them, other times presented by others who are knowledgeable in the field.

Why should you care? There are great sessions already selected for the conference featuring some well-known speakers from the PHP world; why would you want to either attend or present at the uncon?

Continue reading...

CodeWorks 2009 Begins

Today is the kickoff for CodeWorks 2009, a remarkable PHP road show hitting seven cities in 14 days. While I'm not joining the tour until Atlanta, I'm proud to be joining up at that stop and presenting a Zend Framework tutorial during the tour.

CodeWorks'09

Continue reading...

Enabling VPN split tunnel with NetworkManager

I've been using NetworkManager for some time now, and appreciate how easy it makes both connecting to wifi as well as VPNs. That said, I've had an issue with it that I only resolved today.

When working from home, I prefer to use a VPN split tunnel setup — I'm behind a firewall all the time, and it's useful to be able to run virtual machines while still connected to my VPN (e.g., when doing training or webinar sessions). However, I noticed some months ago that this wasn't working. I assumed at first it was a change in our network setup, but others reported that the split tunnel was working fine. It's been particularly problematic when on IRC — if the VPN drops, I lose my IRC connection, meaning I have to re-connect and re-claim my nick.

So, I did some searching, and found an interesting setting. In NetworkManager, "Configure..." then "Edit" your VPN connection, and navigate to the "IPv4 Settings" tab. Once there, click the button that says "Routes..." and select the checkbox next to "Use this connection only for resources on its network". Press Ok to close the dialog, then "Apply" to exit out of the VPN configuration. Re-connect to the VPN, and you should be all set.

Note: this will only work if your VPN server is configured to allow split tunnels. Additionally, only do so if you are behind a firewall. Practice safe networking.

Continue reading...

Cloning the ZF SVN repository in Git

I've been using Git for around a year now. My interest in it originally was to act as a replacement for SVK, with which I'd had some bad experiences (when things go wrong with svk, they go very wrong). Why was I using a distributed version control system, though?

Continue reading...