MagicTemplates
Magically simple PHP templates
Details
Installs
- Total 951
- Win 614
- Mac 186
- Linux 151
May 9 | May 8 | May 7 | May 6 | May 5 | May 4 | May 3 | May 2 | May 1 | Apr 30 | Apr 29 | Apr 28 | Apr 27 | Apr 26 | Apr 25 | Apr 24 | Apr 23 | Apr 22 | Apr 21 | Apr 20 | Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | Apr 13 | Apr 12 | Apr 11 | Apr 10 | Apr 9 | Apr 8 | Apr 7 | Apr 6 | Apr 5 | Apr 4 | Apr 3 | Apr 2 | Apr 1 | Mar 31 | Mar 30 | Mar 29 | Mar 28 | Mar 27 | Mar 26 | Mar 25 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
✨ MagicTemplates ✨
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 °。+ *´¨)
.· ´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·’* ⛧
<?php
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!
Installation
- Run “Package Control: Install Package” command
- Type
MagicTemplates
and press Enter
Configuration
Open Sublime Preferences and add mt-
trigger for xml files:
"auto_complete_triggers": [
[keep_original_triggers],
{"selector": "text.xml", "characters": "mt-"}
],
Examples
PHP Template
PHP Snippets
XML Template and Snippets
How it works?
Templates
When you create a file, plugin do the following things:
- Searches for the closest
composer.json
file (This approach allows to work with multiple projects in the same window) - Detects project type, autoload parameters, and other useful information by its content
- 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.
- Here is a pretty simple template for
[Magento's Collection](https://github.com/vovayatsyuk/sublime-magic-templates/blob/master/templates/magento2/files/Model/ResourceModel/Entity/Collection.php.txt)
- Here is a little bigger template for
[Magento's Form](https://github.com/vovayatsyuk/sublime-magic-templates/blob/master/templates/magento2/files/view/adminhtml/ui_component/form.xml.txt)
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.