daycats / phpstorm-live-templates

Меньше кода!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHPStorm Live Templates

📍 Table of Contents

Read more about JetBrains' live templates here. Use template's header as abbreviation.

Demo GIF

Table of Contents

Typography templates

""

«$SELECTION$»

Typograpghy | Double-angle quotation mark

--

Typograpghy | Emdash (Long dash)

To top

Bootstrap templates

widget

<div class="widget">
    <div class="widget-content padding">
        $SELECTION$
    </div>
</div>

Bootstrap | Widget tags

To top

HTML templates

=

<?= $END$ ?>

PHP | Echo php code.

ec

<?= $END$ ?>

PHP | Echo php code.

yt

<?= Yii::t('frontend', '$SELECTION$') ?>

YII2 | Translation of word via Yii:t()

url

<?= Url::to('$SELECTION$') ?>

YII2 | Url helper

uweb

<?= Url::to('@web/$END$') ?>

YII2 | Url helper

route

<?= Url::to(['$END$']) ?>

YII2 | Url helper

php

<?php $END$ ?>

PHP | Open php tag

nf

<?= number_format($VAR$, 0, ',', ' ') ?>

PHP | Number Format

foreach

<?php foreach($ARRAY$ as $KEY$ => $VALUE$): ?>
    $SELECTION$
<?php endforeach ?>

PHP | Generates/surrounds selection with foreach

if

<?php if ($CONDITION$) : ?>
    $SELECTION$
<?php endif; ?>

PHP | Generates/surrounds selection with if

var

<?php
/**
 * @var $END$
 */
?>

PHPDoc | Generates PHP comment block with @var

cmt

<?php /*
$SELECTION$
*/ ?>

PHP | Generates/surronds selection with php comment

To top

PHP templates

rmt

$this->registerMetaTag([
    'name' => '$TAGNAME$',
    'content' => $SELECTION$,
]);

Yii2 | Register Meta-tags

yiitrans

$transaction = Yii::$app->db->beginTransaction();
try {
    $SELECTION$
} catch (\Exception $e) {
    $this->addError('exception', YII_DEBUG ? $e->getMessage() : Yii::t('common', 'Exception'));
}
if ($this->hasErrors()) {
    $transaction->rollBack();
} else {
    $transaction->commit();
}

Yii2 | DB transaction

act

public function action$NAME$($PARAMETERS$)
{
    return $END$;
}

Yii2 | Controller action

To top

Contributors

About

Меньше кода!

License:MIT License