Best practice module setup with composer

There are several ways how to setup your module development environment with OXID eShop. The most common way is to clone your composer module repository directly to the source/modules folder and register the namespace. Like this all changes to your module will take place immediately.

  • Checkout module to the modules directory in the OXID eShop.
cd <shop_directory>/source/modules/<vendor>
git clone <git_path_to_module_repository> <module_id>
  • Register the namespace to the shop composer file.
"autoload": {
    "psr-4": {
        "<namespace>": "./source/modules/<vendor>/<module_id>"
    }
}
  • Update the autoloader
composer dump-autoload

Dealing with other libraries

If your module has dependencies to other libraries they need to be registered as well in the project composer.json

cd <shop_directory>
composer require package-vendor/package-name