Skip to content

rocket-firm/phpstorm-live-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHPStorm Live Templates

You can download configs with all of the Templates listed below as one file ⬇️ Here

📍 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('app', '$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

dd 

<?php
echo '<pre>';
var_dump($END$);
echo '</pre>';
exit();
?>

PHP | Dump variable and exit

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 {
    $END$
    $transaction->commit();
} catch (\Exception $e) {
    $transaction->rollBack();
}

Yii2 | DB transaction

act

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

Yii2 | Controller action

yt

Yii::t('app', '$SELECTION$');

YII2 | Translation of word via Yii:t()

dd

echo '<pre>';
var_dump($END$);
echo '</pre>';
exit();

PHP | Dump variable and exit

To top

JavaScript templates

con

console.log($END$);

JavaScript | Console log

pex

process.exit();

JavaScript | NodeJS exit

To top

Contributors

About

Optimize repeatable actions and do the logic instead

Resources

License

Stars

Watchers

Forks

Packages

No packages published