Until the PHPStorm issue IDEA-184753 is resolved, the normal installation process for read-only repositories will not work.
Instead, you will need to install this collection of templates manually. You can do this by getting your configuration directory from https://www.jetbrains.com/help/idea/tuning-the-ide.html, then symlinking the Magento.xml template into it's template directory.
For example on a Mac you would:
# clone out the repo
git clone git@github.com:markshust/phpstorm-magento-live-templates.git ~/Sites/phpstorm-magento-live-templates
# setup a symlink to the template within the templates directory
# ln -s ~/Sites/phpstorm-magento-live-templates/templates/Magento.xml ~/Library/Application\ Support/JetBrains/<product><version>/templates/Magento.xml
# for example, PHPStorm 2020.2:
mkdir ~/Library/Application\ Support/JetBrains/PhpStorm2020.2/templates/
ln -s ~/Sites/phpstorm-magento-live-templates/templates/Magento.xml ~/Library/Application\ Support/JetBrains/PhpStorm2020.2/templates/Magento.xml
After restarting PHPStorm, the live templates should then show up at Preferences > Editor > Live Templates > Magento.
Please upvote the issue at IDEA-184753 and show your support for it in a comment, so the following steps can be used instead once it is resolved:
- In PHPStorm, Go to Preferences > Tools > Settings Repository
- Add a new Read-only Source with the URL: https://github.com/markshust/phpstorm-magento-live-templates
- Restart PHPStorm
With a file open, start typing the live template abbreviation. If a lot of other autocompletes show up, tap the up arrow (live template abbreviations appear last).
magentoAclXml
: template for acl.xmlmagentoConfigClassPreferenceXml
: template for class preference within config XMLmagentoConfigPluginXml
: template for plugin within config XMLmagentoCspXml
: template for csp_whitelist.xmlmagentoDiXml
: template for di.xmlmagentoEventXml
: template for event.xmlmagentoLayoutsXml
: template for layouts.xmlmagentoLayoutViewModelXml
: template for view model within layout XMLmagentoLayoutXml
: template for layout.xmlmagentoMenuXml
: template for menu.xmlmagentoModuleXml
: template for module.xmlmagentoRegistrationPhp
: template for registration.phpmagentoRoutesXml
: template for routes.xmlmagentoWebapiXml
: template for webapi.xml
- Find the PHPStorm configuration directory for your operating system
- Inside that directory is a
templates
directory - You can clone this repo out to this directory and submit edits to the
Magento.xml
file
All live templates are to be suffixed with either Xml
or Php
depending on the scope. This is to avoid confusion since a lot of templates will be created over time.
This course is sponsored by M.academy. Level up your Magento 2 skills with a collection of resources including lessons, courses & more.
If you find this repo useful, you may enjoy the following course to learn more about relatively unknown tips, tricks & improvements for PHPStorm:
Obscure PHPStorm Hacks