Blade Snippets
Snippets for blade template engine
Details
Installs
- Total 154K
- Win 98K
- Mac 28K
- Linux 28K
Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | 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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 3 | 2 | 1 | 4 | 1 | 2 | 2 | 0 | 0 | 2 | 3 | 2 | 3 | 7 | 7 | 4 | 2 | 4 | 3 | 2 | 1 | 2 | 3 | 2 | 4 | 2 | 2 | 2 | 4 | 5 | 5 | 7 | 5 | 1 | 6 | 2 | 4 | 2 | 2 | 3 | 3 | 4 | 1 | 2 | 6 | 5 |
Mac | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 2 | 0 | 0 | 0 | 1 | 0 | 2 | 2 | 0 | 0 | 0 | 2 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 2 |
Linux | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 2 | 1 | 0 | 3 | 0 | 0 | 0 | 1 | 1 | 2 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 2 | 4 | 1 |
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 |
eif | @elseif (condition ) {{– expr –}} |
switch | @switch($i) @case(case1) First case… @break @default Default case… @endswitch |
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'] ) |
incwhen | @includeWhen(boolean , 'view.name ', ['some' => 'data'] ) |
incf | @includeFirst(['custom.admin ', 'admin '], ['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 |
prepend | @prepend('name ') {{– expr –}} @endprepend |
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 |
canany | @canany('policy ', $model) {{– expr –}} @endcanany |
cananye | @canany(['policy ', 'policy '], $model) {{– expr –}} @elsecanany([' policy ', 'policy '], $model) {{– expr –}} @endcanany |
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 ') }} |
csrf | @csrf |
method | @method('PUT ') |
json | @json(expression ) |
dump | @dump(expression ) |
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.