Skip to content

Instantly share code, notes, and snippets.

@eugene-petrov
Last active October 12, 2021 10:36
Show Gist options
  • Save eugene-petrov/e37a99d696b47700552c1ef9c0cc557e to your computer and use it in GitHub Desktop.
Save eugene-petrov/e37a99d696b47700552c1ef9c0cc557e to your computer and use it in GitHub Desktop.
How to develop Magento 2 composer packages
1) Create a folder with your extension.
E.g. extensions/Snippet/YourPackageName
The folder YourPackageName contains your module which has composer and git inited.
2) Execute
composer config repositories.yourname path ../extensions/Snippet/YourPackageName
3) Execute
composer config minimum-stability dev
4) Execute
composer require {your-vendor}/{your-magento-package-name}
Done! Composer will create a symlink to the specified folder.
Now you can develop your extension without executing "composer update package-name" all the time.
P.S.
- you will need to add your repository to "Version Control" in PhpStorm.
Here you will find how to do that:
https://www.jetbrains.com/help/phpstorm/enabling-version-control.html#associate_directory_with_VCS
- if you face the following exception:
Exception #0 (Magento\Framework\Exception\ValidatorException): Path "/var/www/extensions/Snippet/Controller/view/frontend/templates/controller_list.phtml" cannot be used with directory "/var/www/source/"
try this:
https://magento.stackexchange.com/questions/95071/magento-2-does-not-allow-linking-modules-using-symlinks/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment