ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Blade Snippets

by dev4dev ST2/ST3

Snippets for blade template engine

Labels snippets

Details

  • 2017.09.25.08.53.05
  • github.​com
  • github.​com
  • 4 weeks ago
  • 1 hour ago
  • 5 years ago

Installs

  • Total 74K
  • Win 42K
  • OS X 17K
  • Linux 15K
Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4
Windows 72 72 72 60 43 48 63 85 40 74 75 71 59 57 66 67 73 68 42 58 39 51 62 69 69 52 59 53 59 76 65 84 62 87 80 99 82 80 55 48 54 65 62 63 48 55
OS X 23 20 18 17 21 15 18 22 11 21 15 10 13 13 21 21 16 23 15 11 19 27 23 16 16 16 15 18 17 22 14 21 15 11 29 29 21 24 16 9 10 17 18 9 17 11
Linux 19 16 14 17 12 17 15 16 17 24 21 14 10 14 28 26 23 27 20 12 18 24 14 22 27 12 14 14 25 20 21 22 13 16 23 20 23 15 8 15 7 19 28 17 24 24

Readme

Source
raw.​githubusercontent.​com

Blade Snippets for Sublime Text

Blade is a simple, yet powerful templating engine provided with Laravel PHP framework.

These snippets works with blade files (.blade.php) either with php syntax or with blade syntax using: PHP - Laravel Blade available from Laravel Blade Highlighter package.

Usage

When you’re editing a blade file, type the snippet shortcut then press tab key.

Installation

Via Package Manager search for Blade Snippets then click/tap…wait a sec and tadam!

Or clone this repository into your Packages folder:

git clone https://github.com/dev4dev/blade-snippets.git

Or download the snippets zip file and unzip it into your Packages folder.


Available Snippets

Template management

Shortcut Result
lay @layout('name')
ext @extends('name')
sec @section('name')
{{– expr –}}
@endsection
secy @section('name')
{{– expr –}}
@yield_section
secsim @section('name', 'content')
hass @hasSection('name')
{{– expr –}}
@else
{{– expr –}}
@endif
yl @yield('section', 'default')
lsec @section('name')
{{– expr –}}
@show
par @parent

Components & Slots

Shortcut Result
comp @component('component', 'data')
{{– expr –}}
@endcomponent
slot @slot('slot')
{{– expr –}}
@endslot

Displaying data

Shortcut Result
!! {!! $var !!}
}} {{ escaped output }}

Blade & JavaScript Frameworks

Shortcut Result
@{{ @{{ javascript }}
verb @verbatim
{{– code –}}
@endverbatim

Control Structures

Shortcut Result
if @if (condition)
{{– expr –}}
@endif
ife @if (condition)
{{– expr –}}
@else
{{– expr –}}
@endif
unless @unless (condition)
{{– expr –}}
@endunless
for @for ($i = 0; $i < ; $i++)
{{– expr –}}
@endfor
foreach @foreach($array as $element)
{{– expr –}}
@endforeach
fore @forelse ($array as $element)
{{– expr –}}
@endforelse
while @while (condition)
{{– expr –}}
@endwhile
inc @include('view.name', ['some' => 'data'])
incif @includeIf('view.name', ['some' => 'data'])
each @each ('item.view', $items, 'item', 'empty.view')
continue @continue('condition')
break @break('condition')
php @php
{{– expr –}}
@endphp
empty @empty (condition)
{{– expr –}}
@endempty
isset @isset (condition)
{{– expr –}}
@endisset

Stacks

Shortcut Result
stack @stack('name')
push @push('name')
{{– expr –}}
@endpush

Authentication Shortcuts

Shortcut Result
auth @auth('name')
{{– expr –}}
@endauth
guest @guest('name')
{{– expr –}}
@endguest

Policies

See the Laravel Policies documentation.

Shortcut Result
can @can('policy', Model::class)
{{– expr –}}
@endcan
cane @can('policy', $model)
{{– expr –}}
@else
{{– else expr –}} @endcan
cannot @cannot('policy', Model::class)
{{– expr –}}
@endcannot
cannote @cannot('policy', $model)
{{– expr –}}
@else
{{– else expr –}} @endcannot

Miscellaneous

Shortcut Result
route {{ route('name') }}
asset {{ asset('path') }}
url {{ url('path') }}
choice @choice('language.line', $number)
comment {{– comment –}}
inject @inject('name', 'App\Services\ServiceName')
trans {{ trans('language.line') }}
lang @lang('language.line', ['variable => 'replacement'])
__ {{ __('language.line') }}

Envoy snippets

Snippets for Laravel Envoy.

Shortcut Result
serv @servers(['web' => 'user@192.168.1.1'])
task @task('foo')
command
@endtask
set @setup
{{– expr –}}
@endsetup
mac @macro('deploy')
command
@endmacro
aft @after
hip
@endafter
hip @hipchat('token', 'room', 'Envoy', “$task ran in the $env environment.”)
sla @slack('hook', 'channel', 'message')
story @story('deploy')
command
@endstory

Blade Wordpress Plugin

Snippets for Blade Wordpress Plugin.

Shortcut Result
wpp @wpposts
{{– expr –}}
@wpempty
{{– empty expr –}}
@wpend
wpq @wpquery (['post_type' => 'post'])
{{– expr –}}
@wpempty
{{– empty expr –}}
@wpend
acf @acfrepeater ('fieldname')
{{– expr –}}
{{ get_sub_field('fieldname') }}
@acfend

Original snippets by: @dev4dev

Cool Readme formatting: GitHub: @AAlakkad.

Contributors