WebDAV, PHP and You

WebDAV seems to be the red-headed stepchild of the protocol world. It’s advocates have long stood in the desert railing against things like FTP for editing files on remote servers. They go on and on about things like it working over port 80 and being much better integrated into Windows, Mac and Linux than FTP.

But, like many who preach in the desert, they’ve been ignored for years for reasons other than their actual message.

However, over the past few years, WebDAV has started gaining traction as the underlying protocol for Subversion repositories over the web and in several other places. That makes this story about a new PHP library for working with WebDAV interesting.

It caught my eye, because I recently set up ALL of my machines to use JungleDisk and to do automatic backups to the WebDAV drives that it provides.

Those WebDAV drives are backed by Amazon’s S3 online disk service, meaning you get an infinite hard drive for storing whatever. Combine that with this new PHP library and you can get simple access to the giant hard drive in the sky for storing and retrieving data, backing things up, etc. Pretty cool in my book.

via PHPDeveloper

Amazon’s Flexible Payment Service

Ever since some juvenile delinquent cracked into my Paypal account and attempted to send $12,000 to a bunch of his friends in the former Soviet republics back in 2001, I’ve avoided Paypal at all costs. Unfortunately, that’s made doing small-scale ecommerce online rather difficult in the ensuing years.

There’s always the Payflow and other bank-based systems, but they make you do quite a bit more legwork on things like fraud. They also aren’t great solutions if you just need to process a few site subscriptions or the occasional Craigslist transaction. Google’s checkout is an option, but is more oriented to “stores” and is fairly rigid in its use.

That’s why the announcement of Amazon’s Flexible Payment Service struck me as interesting. And, what struck me as most interesting is the fact that, like their EC2 (on demand virtual server) and S3 (virtual storage) services, this is built from the ground up as an API for developers, not a consumer product.

So, at launch, this isn’t something users use directly. Rather, it’s something you can use to make payments for your subscription site easy or to integrate your own version of micropayments into your content management system, etc. From what I read in their documentation, they’re really providing as deeply flexible of a system as I’ve seen for collecting, moving around and distributing money online.

I really like that approach that Amazon takes. By starting with an API, they don’t lock themselves into a specific solution. They leave it open to innovation and provide a platform instead of a packaged approach. This is far more likely to result in interesting applications than providing rigid “Buy Now” buttons that get shoehorned into sites where the concept doesn’t really apply.

The API is in limited beta at the moment, but there is already PHP code for working with the service if you sign up for and get into the beta. I know I’m looking at it seriously for some subscription/member sites that I’m working on.

Combining CakePHP and the Zend Framework

The Zend Framework definitely takes a different approach than many of the other PHP frameworks (CakePHP, Zend, CodeIgniter, etc.). It really ends up being more of a collection of libraries than the others do.

In some ways, that makes positioning the Zend Framework as being substantively different from the libraries in PEAR. If you look at what the framework does, there’s not a lot of difference between it and many of the classes in PEAR. I’ll leave it to the reader to decide if these libraries were bundled into a “framework” because frameworks are the hot PHP topic right now or because they really wanted a cohesive approach to web development.

All of that aside, there’s some really useful stuff in the Zend Framework, like the Google Calendar stuff I mentioned a couple of days ago. The fact that ZF does come packaged as what amounts to a PEAR package means you can actually fairly easily use those interesting bits from inside *other* PHP frameworks.

One of the reasons I was messing with the Google Calendar stuff in the first place is that I’m *also* messing with CakePHP to build a homegrown solution for time tracking, invoicing and revenue projection for my consulting business. It’s helpful to be able to mark days like holidays and planned vacations as non-billable so you don’t include them in projections.

At any rate, I went looking for information on including bits from the Zend Framework in my Zend project. It ends up being really simple. This older article covers it pretty well and gives you an idea of how to provide “vendor” wrappers around other 3rd party PHP libraries as well.

Blackbird: Enterprise Service Bus in PHP

It’s been great to see the frenzy of development activity in the non-user space over the last couple of years. When I first started working with PHP, lo those many years ago, it seemed that all of the open source projects were to build applications for users. There was some activity to build some basic libraries, but it was still mostly application-based.

Unfortunately, many other languages got lots of utility code in the form of frameworks and things like enterprise service buses, with Java being the center of much of that activity. Of course, I wouldn’t say that ESB’s are always necessary (hardly anything is universally useful or useless), but they certainly can be helpful in many of today’s environments.

Because ESB’s are pretty much built to provide uniform and abstract interfaces to all sorts of different systems and resources, they can be a real godsend in one of those environments that has a real patchwork quilt of technologies built up over time. Those companies often can’t reasonably get rid of or replace those older systems and an ESB can let you revive their usefulness.

At any rate, a new PHP-based ESB announced today, called Blackbird. Their quick explanation is:

Blackbird fits into the physical-entity category. It is designed to allow developers, with minimal code, to write and integrate applications. Developers create classes that are loaded and managed by Blackbird, and Blackbird provides facilities to connect to external resources, such as message queues, application ports (SOAP, SMTP, etc.), databases, and so on.

which is from their “What is an ESB?” FAQ.

Given how much this looks more like the stuff I face every day than the simple Rails-style view of reality that many other middleware projects show, this might very well prove very interesting as far as I’m concerned.

PHP, Google Calendar and the Zend Framework

Over on my personal site, I wrote up a simple set of scripts to get started with Google’s API for the calendar by using the Zend Framework with PHP. I’m using it to track my daily accomplishments for easily assembling status reports, salary and rate negotiations, resume’s, etc. While this is only a start, I think it offers considerable promise for tracking that kind of information tied to dates.

Using AuthComponent for Access Control in CakePHP

It’s a pretty rare application that doesn’t need to know who is performing a given action. Nearly everything that is built needs at least some level of authentication and authorization before users can be let loose to use it. Unfortunately, not only is there a lot of confusion out there on how to use it, but lots of poorly done, reinvented wheels out there because of it.

Part of the confusion comes in that authentication and authorization are 2 different things. Authentication answers the question: “Who are you?”. That’s it. Authorization answers the question: “Am I allowed to do X to object Y?”.

As I’ve been messing with CakePHP the last couple of weeks, I’ve done what lots of people do to deal with this whole messy issue: put it off until later. Right now, my CakePHP app is wide open for all activities. There’s no restrictions on anything.

That’s why, when an article on AuthComponent for CakePHP came across the CakePHP mailing list this morning, I jumped on it. AuthComponent is the de facto solution for authentication and authorization in CakePHP and this tutorial explains how to implement it fairly easily.

Now, I don’t have to spend a lot of time coming up with a solution to keep users’ data separate, I can just focus on the rules that my authorization grid needs to implement.

Time to Retire PHP 4?

PHP4 is now 7 years old and PHP5 is actually 3 years old. However, despite the fact that PHP5 has been around that long, PHP4 is holding on tightly, particularly on typical cheap shared hosting. Unfortunately, the very reason that PHP has had much of its success in adoption is causing this problem. Lots of people use PHP because you can get a $5/month hosting account and PHP will be installed and you can get up and running quickly.

However, users of those hosting services aren’t really in a position to do the upgrade themselves. Even some of those who are renting dedicated servers are stuck due to those wonderful custom setups that control panels like cPanel use.

The GoPHP5 is pushing to get PHP5 adopted in those critical spots. They’ve got a bunch of applications and hosts that are all planning on going PHP5-only in February. Check to see if your favorite application or your hosting company is on the list.

Project Zero: Agile Development Environment

It always piques my interest when a company like IBM takes action in a PHP direction. Their incubator project ProjectZero is described as:

Project Zero introduces a simple environment for creating, assembling and executing applications based on popular Web technologies.

And, as one would expect, ProjectZero is primarily a Java stack of tools, including the use of Eclipse as a code editing environment. Within the stack, the primary scripting language is, unsurprisingly, Groovy. However, I *was* surprised that the 2nd (and only other) scripting language was PHP and not virtual PHP, but real PHP.

The toolkit looks like it’s got some really nice features, including the fact that it speaks REST natively. Might be worth setting it up and giving it a go.

Finally Another RESTful PHP Framework: Konstrukt

There’s something smelling sweet in Denmark: a nice, lean RESTful framework in PHP called Konstrukt. Given the simple nature of the REST architecture, the full-blown frameworks are really overkill. Yet, at the same time, there are some repetitive bits for handling the HTTP overhead that really could do with some assisting code.

That’s pretty much where Konstrukt drops into the ecosystem. It’s not trying to be yet another Rails clone. There’s no database abstraction layer, no CRUD stubbing, etc. Just the stuff necessary for doing the REST bits, leaving you to build the rest of your application however you see fit.

Overall, this approach is probably more likely to mean the framework can be used in the real world, where you often can’t change your entire development approach just to match the framework. You can use the existing libraries you’re already comfortable with, but now with REST.

Definitely worth a look.

Huge Performance Gains For PHP By Running Inside . . . Java?

One of the trends I’ve been seeing and liking over the last couple of years is a complete decoupling of the programming language that a given piece of functionality is written in and the ecosystem in which it is executed. That’s the huge power of the Mono.NET platform. Lots of people think that the only way you can write .NET software is to do it in C# or VB.NET and deploy on Windows. That’s not even remotely true. As of this writing, there are 55 languages you can use to write .NET assemblies and executables.

Once compiled, any of those assemblies can be used from any one of the other languages and it works. And, for the most part, you can then also run them on Mono on Linux and any of the other platforms Linux runs on.

I said all of that to say that finding that these guys managed to get a 4-fold increase in speed for Drupal (the PHP portal management/CMS tool) by running it in a Java environment to be an exciting revelation.

Why?

Because when you achieve this level of decoupling, you use programming languages because of how they let you *work* instead of worrying about how they *run*. If a tool or library or framework can let you cut your development time in half, you can use it, despite the runtime not being the quickest. Deploying it becomes a secondary task and can be optimized separately.

Now, we’re not entirely there yet, but there’s surprisingly large pockets of this stuff popping up and I’ll be standing over here in the cheering section.