This topic describes the recommended approach for developing Composer modules in-place (as Git repositories in the
vendor/ directory) and adding those modules to your main Git project.
These guidelines apply primarily to global reference architecture (GRA) projects.
Create or check out the development branch in your main Git repository.
Require development versions for each module that you maintain.
In this example, every branch in your main Git repository represents a Composer package version. The recommended naming convention for Composer versions in this scenario is
dev- followed by the branch name. For example:
composer require client/module-example:dev-develop
If another Composer package requires a specific version of a module (for example,
client/module-example 1.0.12), install it with an alias:
composer require 'client/module-example:dev-develop as 1.0.12'
qa branch, replace
By default, packages do not contain a
.git/ directory. Composer can check out packages from Git instead of using the pre-built Composer packages. The advantage to this approach is that you can easily modify the packages during development.
Remove the module from the
rm -rf vendor/client/module-example
Reinstall the module using the specified Git source.
composer install --prefer-source
Verify that the Composer package is now a Git repository:
cd vendor/client/module-example git remote -v
To batch-convert multiple modules into Git repositories (for example “client” modules):
rm -rf vendor/client composer install --prefer-source
Create or check out a feature/working branch. The following example shows a branch with the same name as a Jira ticket.
cd vendor/client/module-example git checkout master git checkout -b JIRA-1200
After changing branches in a module, see the changes by flushing the Adobe Commerce cache and static content.
bin/magento cache:flush bin/magento module:enable --all --clear-static-content
Update your main Git repository by modifying the
composer.lock file. If your module is new, enable it.
# to update your packages and all dependencies of the package composer update --with-all-dependencies client/module-example # to update just your package composer update client/module-example bin/magento module:enable Client_ModuleExample git add composer.lock app/etc/config.php git commit