Code Monkey home page Code Monkey logo

phpstorm-magento-live-templates's Introduction

markshust/phpstorm-magento-live-templates

PHPStorm Live Templates for Magento 2

Table of contents

Installation ⚠️

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 [email protected]: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:

  1. In PHPStorm, Go to Preferences > Tools > Settings Repository
  2. Add a new Read-only Source with the URL: https://github.com/markshust/phpstorm-magento-live-templates
  3. Restart PHPStorm

Usage

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).

Available live templates

  • magentoConfigClassPreferenceXml: template for class preference within config XML
  • magentoConfigPluginXml: template for plugin within config XML
  • magentoCspXml: template for csp_whitelist.xml
  • magentoDiXml: template for di.xml
  • magentoEventXml: template for event.xml
  • magentoLayoutsXml: template for layouts.xml
  • magentoLayoutViewModelXml: template for view model within layout XML
  • magentoLayoutXml: template for layout.xml
  • magentoModuleXml: template for module.xml
  • magentoRegistrationPhp: template for registration.php
  • magentoRoutesXml: template for routes.xml

Contributing

  1. Find the PHPStorm configuration directory for your operating system
  2. Inside that directory is a templates directory
  3. 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.

Free Course

This course is sponsored by M.academy. Level up your Magento 2 skills with a collection of resources including lessons, courses & more.

M.academy

If you find this repo useful, you may enjoy the following course to learn more about relatively unknown tips, tricks & improvements for PHPStorm:

Course image

Obscure PHPStorm Hacks

License

MIT

phpstorm-magento-live-templates's People

Contributors

markshust avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.