Using annotations in Prooph

One of the things I love about Java is its native, compiler-level support for annotations, a form of syntactic metadata which can be applied to source code but also retain at run-time to influence application behavior. I use them almost daily in my projects.

I do a fair amount of consulting and development on event sourced applications and these usually use Axon, a popular CQRS & event sourcing framework. Recently, Axon version 3 was released, supporting a number of annotations that can turn any POJO (Plain Old Java Object) into an event-sourced aggregate.

The annotations in Axon inspired me to experiment with adding support for similar annotations to prooph, a PHP framework which I occasionally reference in my PHP conference talks and consulting. This experiment is now available online as a PHP package, on GitHub: It works with the last versions of the core prooph components.

The package, like Axon, introduces a number of annotations which allow you to turn any regular PHP class into an event-sourced aggregate. Unfortunately, annotations are not natively supported in PHP. They are written inside documentation blocks and require an additional parser to get working (in the case of my package, Doctrine Annotations). The following example snippet shows how these annotations are applied:

@CommandHandler helps to get rid of some of the boilerplate code usually associated with command handlers in prooph (see this example). @EventHandler turns any annotated function into an event listener.

Let me know what you think!

The road to continuous deployment (PHPCon Poland 2016)

Below are the slides of my talk “The road to continuous deployment: a case study”, as presented at PHPCon Poland in October 2016.

It’s a situation many of us are familiar with: a large legacy application, limited or no tests, slow & manual release process, low velocity, no confidence…. Oh, and management wants new features, fast.

But how to proceed? Using examples and lessons learned from a real-world case, I’ll show you how to strangle the legacy application with a modern service architecture and build a continuous deployment pipeline to deliver value from the first sprint. On the way, we take a look at testing strategies and various (possibly controversial!) tips and best practices.