欢迎光临
我们一直在努力

让laravel使用PHPStorm Live Templates的功能

有好些phpstorm使用者都知道它有live templates功能,但不知道怎么去定义或使用,详见,以下是从网上搜集来的资料,方便大家使用Live Templates,未做全文翻译。

Abbreviation Description

Here are some of mine:

Forms

通过Live Template我们可以快速创建表单,使用模板可以节省更多时间。

fo Form open tag

 

fc Form close tag

 

textfield Text form field

 

emailfield Email form field

 

passwordfield Password form field

 

textareafield Text area form field

 

hiddenfield Hidden form field

 

submitfield Submit form field

 

req Require field (add in the attribute array of any form field type to make field required.

 

Annotations

I’ve been playing with 5.0 for a few weeks now and so I’ve added a few route annotation templates. I’m sure more will be added over the coming months.

anno Add docblock ready for annotations below

 

@G Get route annotation

 

@P Post route annotation

 

@M Get route annotation

 

Blade Live Templates

I’ve been using these less since native blade support was added to PHPStorm but they are still useful.

@ex Blade extend

 

@fe Blade foreach

 

@if Blade if

 

@ife Blade if/else

 

@inc Blade include

 

@sect Blade section

 

@yi Blade yield

 

bb {{ }} unescaped blade tags

 

bbb {!! !!} escaped blade tags

 

view New view from layout

 

Testing

A few testing templates, I’m only just getting properly into test so I will be adding to these.

cci Codeception $I->

 

@test Test outline

 

HTML

I use these when I’m working on a throw away project and need to quickly import some basic styles and scripts.

bootcss Bootstrap css CDN link

 

bootjs Bootstrap js CDN link

 

jquery jQuery CDN link

 

lorem lorem ipsum generator

 

Composer packages

I have a few packages that I add to every laravel install I do. Rather than have to remember the correct package number I just create a template to insert it into my composer file automatically (note: these are for Laravel 5).

gener Way/Generators

 

illhtml Illuminate/Html

 

reqdev Add require-dev to composer.json file

 

Misc

A few more that don’t quite fit into any category

lt Link to

 

ltr Link to route

errors Error loop

 

其它模板分享:

.container>.col-md-10.col-md-offset-1>p.placeholder*6>lorem75 [tab]

结果:

当然你也可以通过以下方式来定义模板

parr Print array enclosed with <pre> tags

field

 

赞(0)
版权归原作者所有,如有侵权请告知。达维营-前端网 » 让laravel使用PHPStorm Live Templates的功能

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址