# Local module development - how to handle custom modules and autoload paths?

**URL:** <https://forum.oxid-esales.com/t/local-module-development-how-to-handle-custom-modules-and-autoload-paths/98729>\
**Category:** English forums\
**Created:** [October 2, 2022, 5:38am UTC](https://forum.oxid-esales.com/t/local-module-development-how-to-handle-custom-modules-and-autoload-paths/98729 "2022-10-02T05:38:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![walldemar](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/walldemar/32/261_2.png) [@walldemar](https://forum.oxid-esales.com/u/walldemar)\
**Post date:** [October 2, 2022, 5:38am UTC](https://forum.oxid-esales.com/t/local-module-development-how-to-handle-custom-modules-and-autoload-paths/98729/1 "2022-10-02T05:38:05Z")

</div>

Hi,  
I have client OXID project (EE 6.2) where are installed external modules (bought modules from external developers) and my custom modules which are taken from remote repositories. All modules handle composer installation strategy (metadata: 2.1)

**Question 1:**  
How you keep you local development?  
I mean…  
let’s say you installed a new project with **composer install** command.  
Composer will install OXID and your custom modules from remote repository.  
In that case all .git folders are in vendor directory.

It’s a little bit confusing for me… because when I want to do some changes I need execute composer update each time to see the results?  
or maybe I should do symlink from **vendor/custommodule** to **source/custommodule**?

**Question 2:**  
Do I need to put all autoload paths in project composer.json file to my custom modules when I am working in local development?

Thanks for suggestions.

---

<div class="post-metadata">

**Author:** ![vanilla\_thunder](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/vanilla_thunder/32/72_2.png) [@vanilla\_thunder](https://forum.oxid-esales.com/u/vanilla_thunder)\
**Post date:** [October 2, 2022, 9:55am UTC](https://forum.oxid-esales.com/t/local-module-development-how-to-handle-custom-modules-and-autoload-paths/98729/2 "2022-10-02T09:55:33Z")

</div>

Q1: it depends mostly on the kind of changes, you want to make visible:

1. if you added external dependency in module’s composer.json and need to install it now, you got to use composer.
2. if you have changed metadata.php ite enough to install module configuration `vendor/bin/oe-console oe:module:install-configuration <module path>`

Q2: if your module’s directory and file names match their namespaces, e.g. Vendor\Module\Core\Class is located in source/modules/vendor/Module/Core/Class.php then it enough to add your vendor folder to the autoload path:

```auto
"autoload": {
  "psr-4": {
    "Vendor\\": "source/modules/vendor",
...

```

---

<div class="post-metadata">

**Author:** ![walldemar](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/walldemar/32/261_2.png) [@walldemar](https://forum.oxid-esales.com/u/walldemar)\
**Post date:** [October 3, 2022, 5:59am UTC](https://forum.oxid-esales.com/t/local-module-development-how-to-handle-custom-modules-and-autoload-paths/98729/3 "2022-10-03T05:59:27Z")

</div>

Thanks for reply 🙂 but probably you understand me wrong or I could describe my problem better 🙂

Q1:

- 1.1: but where you have stored your custom module? where you implement code? in which directory? _ **{project}/source/modules/{vendor}/{mycustommodule}** _ or maybe _ **{project}/vendor/{vendor}/{mycustommodule}** _?
- 1.2: do you execute _ **git push** _ in this directory?
- 1.3: what you do when you execute _ **composer update --no-scripts --no-plugins && composer update** _ and OXID ask you if copy module from vendor to source dir?

Q2:

- 2.1: this means for development purposes it’ is **required** to add manually namespaces in _ **{project}/composer.json** _ file, even if we have namespaces declared in composer.json file in path _ **{project}/source/modules/{vendor}/{mycustommodule}** _. Yes?
- 2.2: you add namespaces in _ **“autoload”: {…}** _ or _ **“autoload-dev”: {…}** _ in _ **{project}/composer.json** _ section?

Thanks for your patience 🙂

---

<div class="post-metadata">

**Author:** ![vanilla\_thunder](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/vanilla_thunder/32/72_2.png) [@vanilla\_thunder](https://forum.oxid-esales.com/u/vanilla_thunder)\
**Post date:** [October 3, 2022, 11:57am UTC](https://forum.oxid-esales.com/t/local-module-development-how-to-handle-custom-modules-and-autoload-paths/98729/4 "2022-10-03T11:57:23Z")

</div>

ok, i think i understand the intention now.  
Bascially. you have two ways of ading your modules to OXID:

1. as composer dependency
2. installing module-configuration manually

If your module does not have external dependencies, that needs to be installed via composer, then you can install module configuration manually and use composer only to create new classmap.

1.1 {project}/source/modules/{vendor}/{mycustommodule}  
1.2 99% of my modules are project-related, so them will always be only in this one particular shop and there will be no updates outside of this shop. Those modules do not have own repositories, so they are part of the project repository for the whole shop. when i run gut push there, its pushed to the main project repositoy  
1.3 i dont use this command, but you are probably adding source/modules/vedor/yourmodule as repository in composer.json, in this case you have to say “no” at this point, as mentioned [here](https://docs.oxid-esales.com/developer/en/6.2/development/modules_components_themes/module/tutorials/module_setup.html)

2.1 no, if you are installing your modules as a composer dependency, you do not have to do that. Only if you install module configuration manually (without composer), then you have to add your namespace there and run “composer dump-autoload”  
2.2 is answered in previous post

---

<div class="post-metadata">

**Author:** ![walldemar](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/walldemar/32/261_2.png) [@walldemar](https://forum.oxid-esales.com/u/walldemar)\
**Post date:** [October 5, 2022, 1:52pm UTC](https://forum.oxid-esales.com/t/local-module-development-how-to-handle-custom-modules-and-autoload-paths/98729/5 "2022-10-05T13:52:17Z")

</div>

OK, it’s clear for me 🙂 thanks.

---

<div class="post-metadata">

**Author:** ![system](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/system/32/4245_2.png) [@system](https://forum.oxid-esales.com/u/system)\
**Post date:** [October 5, 2023, 1:52pm UTC](https://forum.oxid-esales.com/t/local-module-development-how-to-handle-custom-modules-and-autoload-paths/98729/6 "2023-10-05T13:52:41Z")

</div>

Closed on October 5, 2023, 1:52pm UTC

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
