Giter VIP home page Giter VIP logo

phpstorm-m2-filetemplates's Introduction

phpstorm-m2-filetemplates

PHPStorm Magento 2 File Templates

Useful file templates for working with Magento 2.

To install, place the files directly in the appropriate folder. Note that [Version] corresponds to the version of PhpStorm you have installed.

Mac OS

PhpStorm 2020 or newer: ~/Library/Application Support/JetBrains/PhpStorm[VERSION]/fileTemplates/

PhpStorm 2019 and below: ~/Library/Preferences/PhpStorm[VERSION]/fileTemplates/

Windows

PhpStorm 2020 or newer: %USERPROFILE%\AppData\Roaming\JetBrains\PhpStorm[VERSION]/fileTemplates/

PhpStorm 2019 and below: %USERPROFILE%.PhpStorm[VERSION]\config\fileTemplates/

Linux

PhpStorm 2020 or newer: ~/.config/JetBrains/PhpStorm[VERSION]/fileTemplates/

PhpStorm 2019 and below: ~/.PhpStorm[VERSION]/config/fileTemplates/

Create the directories if they are not present.

Note that you must put the templates directly in the above folders, do not put them in a subfolder.

How to Use

Once the templates are installed, you can access them by right-clicking on a folder and selecting New, then From File Template. If you do not see this option, you may have to change your project schema for file templates.

Navigation to Preferences, Editor, File Templates. In that dialog, select Default under Schema. You should see the templates listed in the panel.

phpstorm-m2-filetemplates's People

Contributors

lfolco avatar riconeitzel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

phpstorm-m2-filetemplates's Issues

Add template for ViewModel PHP Classes

ViewModels are the new best practice since 2.2 to extend block functionality using composition over inheritance. The basic idea is that you create a ViewModel class which implements Magento\Framework\View\Element\Block\ArgumentInterface and add it as an argument to a core template block using layout updates. This allows the developer to decouple dependencies and functionality from the block being extended.

See https://medium.com/technogeeks/viewmodels-in-magento-2-7c141acda3c1 for more info.

I have created a live template to add to this repository seen below. If you'd like to add me as a contributor I have many more I can offer as well. Cheers!

M2 viewmodel.php.php

<?php

namespace ${VendorName}\${ModuleName}\ViewModel;

use Magento\Framework\View\Element\Block\ArgumentInterface;

/**
 * Class ${ClassName}
 * ViewModel to inject in template blocks
 */
class ${ClassName} implements ArgumentInterface
{

}

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.