Statemachine is a project mainly written in PHP, it's free.
Kohana module for building state machines