Change MVC folders paths in a plugin

Hi, dear community, I’m looking for the right way to change the MVC classes paths in a plugin instead of following the default framework conventions, if it possible.

Other question, if it is possible to use classes that implement Request handlers instead of the controller?

Thank you for the great framework and this great community.

Why do you want to change the paths? There may be some way, but I see a lot of people trying to bend things to their will just because they have some idea of how it should be instead, when by far the easiest solution is to change the idea of how it should be.

@Zuluru I have existing code to integrate with CakePHP

You have existing models, views and controllers from a non-Cake project that you want to use in a Cake project?

I just have PHP code, classes that hold some logic, not coupled to any framework.
All I want to achieve is to keep the code as it is and make a directory/namespace for CakePHP classes, and configure the paths for those classes.
the code I talk about will be wrapped in CakePHP components or injected via the DI container (which is not stable for now).

If you can put them in namespaces, then put them into things like App/Utility or <PluginName>/Utility, and place the files under src/Utility/<ClassName>.php. Utility, of course, can be anything at all that you prefer, and it can be a hierarchy if that’s useful to you.

None of this would really count as “changing the MVC class paths”, and very much “follows the default framework conventions”. It’s just adding to the standard directory structure, not changing it.

2 Likes

For example, under src, in addition to the standard Controller, Model, Template and View folders, I have Core, Event, Exception, Interface, Lib, Mailer, Middleware, Module, Utility, Validation and XML.

2 Likes