Skip to content
Magically simple PHP templates
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status

Tired to type the same boilerplate code for each new file? MagicTemplates plugin automatically inserts autogenerated content for all known files. And it's not just a static snippet, but a magically generated working code!

# 1. You create a new `Menu.php` file in swissup/module-navigationpro/src/Model/ResourceModel/

# 2. MagicTemplates is doing its job:

⊂   ノ    ・゜+.
しーJ   °+ *´¨)
  .· ´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·*


namespace Swissup\Navigationpro\Model\ResourceModel;

use Magento\Framework\Model\ResourceModel\Db\AbstractDb;

class Menu extends AbstractDb
     * Model initialization
     * @return void
    protected function _construct()
        $this->_init('swissup_navigationpro_menu', 'menu_id');

See? And that was a single example, while module supports much much more!


  1. Run “Package Control: Install Package” command
  2. Type MagicTemplates and press Enter


Open Sublime Preferences and add mt- trigger for xml files:

"auto_complete_triggers": [
    {"selector": "text.xml", "characters": "mt-"}


PHP Template

Template for Magento2 resource model

PHP Snippets

Template and snippets for Magento2 plugin

XML Template and Snippets

Template and snippets for Magento2 form ui_component

How it works?


When you create a file, plugin do the following things:

  1. Searches for the closest composer.json file (This approach allows to work with multiple projects in the same window)

  2. Detects project type, autoload parameters, and other useful information by its content

  3. If the project type matches one of the known types, plugin searches for the template to use. If found - contents is automatically generated and inserted into the file.

Snippets (beta)

Sublime's native snippets mechanism doesn't allow to filter out available snippets depending on filename pattern. MagicTemplates plugin allows to create such kind of dynamic snippets!

This feature allows to reduce the number of shown snippets for various files. For example, when working with Magento's layout.xml file MagicTemplates will never show you autocompletions written for ui_component.xml files.

Additionally, these snippets fully supports MagicTemplates variables which allows to generate more code that simply works.

Known Applications

  • Laravel
  • Magento1
  • Magento2
  • And a few templates and snippets for unknown php applications
You can’t perform that action at this time.