DEV Community

Discussion on: How to write modern PHP application without OOP?

Collapse
 
evgeniir profile image
Evgeniy • Edited

I can find a lot of resources on how to build web apps using OOP "the right way"

Firstly, 95% of them still describe a procedural style, like class with getters and setters + external serivces with procedures.

Second, do you really understand difference between procedural programming an OOP? If this were the case, this question would not arise.

I'm asking that, because I'm planning to write an e-commerce website (vanilla PHP, no framework)

I hope only for the sake of training.

I'm not sure if I will use MVC even.

In fact you won't anyway, because MVC is not about backend-applications, it was invented in 1979 for desktop applications - folk.uio.no/trygver/2007/MVC_Origi... .
The main reason why it is not suitable for the backend - Controlller in MVC does not interact with View, only with models, фnd the views update themselves after the model.

I prefer feature folder structure.

That's good.
I will also mention that MVC(and other patterns or quality frameworks) has nothing to do with the folder structure

I'm curious if anyone had tried anything alike this before.

You should just try.

In addition, if you are really willing to make an effort, I can recommend the book "Clean Architecture" by Robert Martin, it will answer you questions.