In my recent Imagine presentation I talked about keeping your Magento 2 extensions in the vendor folder. The good news is that it is fairly straight forward to convert your extension from one location to the other. Especially if you wanted to quickly trial something out first, there is no harm in developing under
app/code, and only once you are ready to move from your local environment to a staging environment convert it into a Composer package.
cd app/code/Fooman/Example git init git add -A git commit -m 'Initial commit' #The below example uses Bitbucket but you can just as well use a local path to an existing empty git repo git remote add origin ssh://firstname.lastname@example.org/fooman/extension-example.git git tag v1.0.0 git push -u --tags origin master cd ../../../../ #Magento Root folder composer config repositories.fooman-example vcs email@example.com:fooman/extension-example.git composer require fooman/example-m2:1.0.0 --prefer-source rm -rf app/code/Fooman/Example
In case you need to keep working on the extension:
cd vendor/fooman/example-m2 #work #update version number in composer.json to 1.0.1 (this is a Magentoism as technically Composer considers the git tag the version number but Magento's Setup Wizard will read the version number from the composer.json file git add -A git commit git tag v1.0.1 git push --tags
update the main
cd ../../../ composer require fooman/example-m2:1.0.1