An event-driven Slim 4 skeleton using AMQP and CQRS

Robin Ingelbrecht
2 min readFeb 28, 2023

But why though?

I was in need of a no-nonsense, intuitive, and easy-to-use skeleton to set up new (personal) projects. After finishing it, I was pretty happy with the result and I decided to open-source it.

For the last two years I’ve been heavily into DDD, CQRS, and AMQP, so naturally, the skeleton is built with these principles in mind.

When reading the documentation, you’ll notice that I provided two installation profiles:

  • Default: has no examples. You should use this profile if you know what’s up and want to start with a clean slate.
  • Full: has a complete working example including commandHandlers, eventListeners, domain classes, repositories, …

Both are very easy to set up and should provide you with the necessary tools to get you going.

The necessary tools

The development guide will explain to you in great detail what the available features are and how you can use them. Apart from the basic Slim functionality, the skeleton includes:

  • a DI container
  • CLI commands
  • A CQRS implementation
  • An AMQP implementation
  • Eventing
  • Database migrations
  • A template engine

A lot of these functionalities rely on external packages. Why reinvent the wheel, right?

External packages

Some external packages that are used are:

  • PHP-DI: The dependency injection container for humans
  • Symfony console commands: The Console component eases the creation of beautiful and testable command line interfaces
  • Doctrine migrations: offers additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema
  • Twig: Twig, The flexible, fast, and secure template engine for PHP

If you want to start using the skeleton yourself, start off by reading the documentation.

It is far from complete, there might be bugs or features that are not included. For any feature requests, help posts, or bug reports, please open an issue in the issue queue. I’ll be happy to help you out.

Consider giving the repository a ⭐️ if you decide to use the skeleton:

Cover image

--

--

Robin Ingelbrecht

My name is Robin Ingelbrecht, and I'm an open source (web) developer at heart and always try to up my game. Obviously, I'm also into gaming 🎮.