# Bind a command bus to a route instead of just a single command

**URL:** <https://discourse.slimframework.com/t/bind-a-command-bus-to-a-route-instead-of-just-a-single-command/6243>\
**Category:** Questions\
**Created:** [June 30, 2026, 2:05pm UTC](https://discourse.slimframework.com/t/bind-a-command-bus-to-a-route-instead-of-just-a-single-command/6243 "2026-06-30T14:05:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ollehar](https://avatars.discourse-cdn.com/v4/letter/o/0ea827/32.png) [@ollehar](https://discourse.slimframework.com/u/ollehar)\
**Post date:** [June 30, 2026, 2:05pm UTC](https://discourse.slimframework.com/t/bind-a-command-bus-to-a-route-instead-of-just-a-single-command/6243/1 "2026-06-30T14:05:32Z")

</div>

Hello!

Has anyone considered using a command bus with SlimPHP? Instead of binding every route to a single command, you’d bind it to the command bus, with one or more initial commands added to it. The benefit of always having a bus available is that every command can push another independent work unit to it, so you get a natural way to split your code in chunks, similar to a message queue, but internal to your program. If you also make each command a `Generator` you can `yield` all types of cool stuff that way.

---

<div class="post-metadata">

**Author:** ![tj\_gumis](https://avatars.discourse-cdn.com/v4/letter/t/c89c15/32.png) [@tj\_gumis](https://discourse.slimframework.com/u/tj_gumis)\
**Post date:** [June 30, 2026, 7:09pm UTC](https://discourse.slimframework.com/t/bind-a-command-bus-to-a-route-instead-of-just-a-single-command/6243/2 "2026-06-30T19:09:45Z")

</div>

Would you share a problem example that could be solved with a such approach?
