Zend Framework

Multiple Paths for Zend_Layout (Modules Based Layouts)

There was some chatter about using module based layouts with Zend_Layout on freenode, so I thought I’d explore the idea a bit more.  There was this particular idea to use a plugin and a bit of application.ini/xml settings to configure it all.  But I’m a bit old school with my Zend Framework apps.

Coding PHP Zend Framework

All I Need is REST, Vimeo, Flickr, Zend and More

Here’s my skeleton for my magical REST interface. It’s still missing a lot of method calls for Flickr and Vimeo, but the guts are there and the remaining methods will be done in priority when I need them.  Right now it supports automatic caching and logging via simple options.

At some point I’ll probably put it on a public SVN repository, but for now you can have the tarball.  There’s a README in the file with a simple sample. And the source is pretty self explanatory so you should be able to figure it out if you want to.

The remainder of the work will be done in the order I see fit.  Likely read-only methods (most of the getters) Authentication and write methods will be much much later.

I’ll also add more RESTful interfaces as I need them.  Probably Facebook soon, Twitter later.  Who knows.

Drop your comments here if you’ve got any questions.

Coding Java PHP Zend Framework

PHP Java Bridge vs. Zend Platform Java Bridge

A long time ago I posted some instructions on installing PHP/Java Bridge on Ubuntu and that post is getting quite a few reads, so I figured I’d post a follow up on how it was used.

Over the last year I had been using a Java Bridge from a Zend Framework application to access a Java only API.  And really, between the two bridges there are no differences.  They both work identical, they both work great.  Would I pay Zend for Zend Platform’s Enterprise license? No.  Why? Because both bridges perform the same.  The only differences are:

  1. Zend’s Java bridge already has a function called java_require and the open source PHP/Java Bridge needs you to include a file.
  2. PHP/Java Bridge has a java_cast function, and you need it.  Zend’s Java Bridge does not have, or need this.

With these two differences all you need is a little code in your bootstrap (or somewhere else useful) to cover them and all is golden. Your app should work with both Java Bridges without any issue.

/* no java_require() include the for PHP/Java Bridge */
if ( ! function_exists('java_require') ) {
    include "java/";

/* declare this, it doesn't exist with Zend Java, but is needed for PHP/Java Bridge */
if ( ! function_exists('java_cast')) {
    function java_cast($whatever) {
        return $whatever;

There’s probably a more graceful way of checking and doing this but that’s it, and it’s worked on a multi tiered build environment for over a year now.

PHP Zend Framework

Zend Framework 1.8 and Beyond

Zend Framework 1.8 is almost ready and as such, it’s time for me to look into what it’s got.

There’s a good listing of what’s new over here and really on the surface it doesn’t look like much. But as a person who’s been using ZF for quite some time, I’m really happy to see some integrated tools for creating the application structure in a quick and easy way. As long as module creation support makes it in for 1.8, things will be great.

Aside from that, I’ll be interested in seeing what Zend_Navigation has to offer.  Seeing as I’ve had numerous instances with global navigation, crumbs, module based navigation and I’ve had to create something each time – a single one-stop-shop for nav items could prove to be very useful.

Here’s lookin’ to the future.

Update: Zend Framework 1.8 is officially released.

PHP Zend Framework

Some Thoughts on MVC, Bad Design and Confusion

I was reading a post over here about why the ActionStack in Zend Framework is evil.  And I agree. I’ve used ActionStack before in a few older ZF sites (where better alternatives weren’t ready or I just didn’t know about them) but now as the framework has progressed there are many better alternatives to get other ‘actions’ to be executed on every request.

That better alternative is to simply not stack actions. One practice that I’ve been bringing into habit over the last year or so with my coding is to keep my controllers thinned out. As Ryan states: Fat Models, Thin Controllers.  And as things have rolled out over the last few months, I’ve discovered that is a Good Thing™.

Skinny supermodels beware, your jobs are at risk…

Eclipse Zend Framework

Using Environment Variables So You Can Commit Your .project File

Quick Update: this apparently only works with Zend Studio for Eclipse. Sorry for any confusion if you’re trying to figure out where the f$#@ those dialogs are.

All of my projects reside in an SVN repository and now they’re starting to get accessed by multiple users.  Typically with eclipse, I would just have a project that contained externally required libraries – such as the Zend Framework – but now the location of this is required to be more flexible.