# Change MVC folders paths in a plugin

**URL:** <https://discourse.cakephp.org/t/change-mvc-folders-paths-in-a-plugin/8857>\
**Category:** Plugins\
**Created:** [January 11, 2021, 10:59pm UTC](https://discourse.cakephp.org/t/change-mvc-folders-paths-in-a-plugin/8857 "2021-01-11T22:59:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cherif\_b](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/cherif_b/32/2082_2.png) [@Cherif\_b](https://discourse.cakephp.org/u/Cherif_b)\
**Post date:** [January 11, 2021, 10:59pm UTC](https://discourse.cakephp.org/t/change-mvc-folders-paths-in-a-plugin/8857/1 "2021-01-11T22:59:19Z")

</div>

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](https://www.php-fig.org/psr/psr-15/#11-request-handlers) instead of the controller?

Thank you for the great framework and this great community.

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [January 12, 2021, 12:49am UTC](https://discourse.cakephp.org/t/change-mvc-folders-paths-in-a-plugin/8857/2 "2021-01-12T00:49:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Cherif\_b](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/cherif_b/32/2082_2.png) [@Cherif\_b](https://discourse.cakephp.org/u/Cherif_b)\
**Post date:** [January 12, 2021, 8:15am UTC](https://discourse.cakephp.org/t/change-mvc-folders-paths-in-a-plugin/8857/3 "2021-01-12T08:15:05Z")

</div>

@Zuluru I have existing code to integrate with CakePHP

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [January 12, 2021, 4:16pm UTC](https://discourse.cakephp.org/t/change-mvc-folders-paths-in-a-plugin/8857/4 "2021-01-12T16:16:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Cherif\_b](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/cherif_b/32/2082_2.png) [@Cherif\_b](https://discourse.cakephp.org/u/Cherif_b)\
**Post date:** [January 12, 2021, 4:54pm UTC](https://discourse.cakephp.org/t/change-mvc-folders-paths-in-a-plugin/8857/5 "2021-01-12T16:54:01Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [January 12, 2021, 7:38pm UTC](https://discourse.cakephp.org/t/change-mvc-folders-paths-in-a-plugin/8857/6 "2021-01-12T19:38:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [January 12, 2021, 8:56pm UTC](https://discourse.cakephp.org/t/change-mvc-folders-paths-in-a-plugin/8857/7 "2021-01-12T20:56:12Z")

</div>

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.
