Welcome Guest, Not a member yet? Register   Sign In
Help to apply onion architecture in codeIgniter
#9

(11-29-2018, 03:38 PM)ciadmin Wrote: One thing CI4 doesn't have, from an "onion" perspective, is the "independence of frameworks" aspect, unless you consider CI4 to be a technique for achieving that Undecided

Hmm, I dunno, but I'm feeling a bit skeptical about the practicality of truly "framework independent" approach.

So let's assume you can easily switch out database layer with any other DB library.

You'd use entities with CI or Laravel Eloquent to automate/standardise how your models behave.

If you don't want to be framework dependent, you would either have to manually do everything on every single model you write, which IMHO is not practical and is breaking Don't Repeat Yourself principle, or you'd have to write your own custom model extension layer to replicate everything CI/Laravel already gives you out of box.

I don't think (and I have not looked) any mini-framework gives you routing only, or templating/views system only, or model layer only, so just picking and choosing different libraries for different layers is not really a path PHP developers can take at the moment.

Best you could do, again in my opinion, is try to separate concerns in different layers, and that makes 100% sense even if you don't plan to swap frameworks, but accept that you are using framework for a reason, just aim to keep it nice and tidy in right place so moving from one to another is easier task, but still takes manual changes to swapping out one frameworks model handling for another.
Reply


Messages In This Thread
RE: Help to apply onion architecture in codeIgniter - by Pertti - 11-30-2018, 02:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB