Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Randy_Johnson's avatar

Event-Driven Architecture, do I need it?

So am progressing with the website with the help of AI, and its telling me I should implement event driven architecture for my stock/ items page.

Reading through it, it looks pretty complicated. Here is a snippet of code.

app(AdjustInventoryStockAction::class)->execute(
    item: $item,
    newQuantity: $validated['quantity'],
    type: 'adjustment',
    reason: 'Manual inventory update',
    performedBy: Auth::id(),
);

Should I bite the nail and continue down this road since it will eventually lead to a better product, or is AI leading me on a wild goose chance?

0 likes
3 replies
Tray2's avatar

I think you should learn how to code, and then use AI as a tool, and not as a developer.

2 likes
imrandevbd's avatar

Honestly, ignore the AI on this one. What you’ve written is a solid, clean Action class. It’s readable, it handles the transaction properly, and it gets the job done.

EDA is fantastic for decoupling, but it’s absolute overkill for a simple stock adjustment. You only really need to go down that road if a stock change needs to trigger a bunch of unrelated side effects like hitting a third-party API, sending emails, or clearing remote caches and you don't want to bloat your main logic.

1 like

Please or to participate in this conversation.