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

emirmuminoglu's avatar

API for LiveWire project

I am starting a new project and considering to use TALL stack. I will also need an api to consume from a mobile app. What is the best way to have both TALL and an API? Should I abstract business logic with classes and call these methods from both livewire and api or just duplicate everything?

0 likes
2 replies
Snapey's avatar

Most commonly, you would duplicate for blade views and for API responses.

If you can identify reasonable blocks of business logic, you could create action classes that you call from either place to perform the common action.

martinbean's avatar

@emirmuminoglu Yes, you should abstract logic instead of duplicating it. That’s the entire crux of the DRY principle.

Please or to participate in this conversation.