Skip to content

ksmore/phpstorm-laravel-live-templates-1

Repository files navigation

Laravel - Live Templates for PhpStorm

Rework of the famous koomai/phpstorm-laravel-live-templates, inspired by Lykegenes/laravel-5-snippets and dev4dev/blade-snippets for Sublime Text 3 Based on Laravel >= 5.3

How to:

  1. Download and copy the xml file(s) to your templates folder:
  • Windows: <your home directory>\.<product name><version number>\config\templates (create if it is not here)
  • Linux: ~\.<product name><version number>\config\templates
  • OS X: ~/Library/Preferences/<product name><version number>/templates

e.g. C:\Users\<user>\.PhpStorm2017.1\config\templates on Windows 10 for PhpStorm 2017.1

  1. Restart PhpStorm.

  2. To see all templates, go to Preferences->Live Templates and expand the Template Group.

Live templates show up automatically as you type the first few letters. You should still press Cmd + J to filter out everything else (classes, variables, etc).

Template Groups

Blade

Please note that each Blade template require @ sign before.

  • @asset - asset() in curly braces
{{ asset('$ASSET_PATH$') }}
  • @can - simple @can
@can ('policy', App\Model)
@endcan
  • @canelse - @can with @else
@can ('policu', App\Model)
@else
@endcan
  • @cannot - @cannot with @else
@cannot ('policy', App\Model)
@else
@endcannot
  • @choice
@choice('lang.line', $number)
  • @continue
@continue
  • @each
@each('item.view', $items, 'item', 'empty.view')
  • @extends
@extends('view')
  • @for
@for ($i = $start; $i > $count; $i++)
@endfor
  • @fore - @forelse with @empty
@forelse ($array as $element)
@empty
@endforelse
  • @foreach
@foreach ($array as $element)
@endforeach
  • @if
@if (condition)
@endif
  • @ifelse
@if (condition)
@else
@endif
  • @include - simple @include
@include('view')
  • @inc_data - @include with data array
@include('view', ['data' => $data])
  • @inject
@inject('name', 'App\Services\ServiceName')
  • @lang
@lang('line')
  • @lang_rep - @lang with data
@lang('line', ['variable' => $value])
  • @lang_json - __() helper
{{ __('line') }}
  • @section - simple @section
@section ('section')
@stop
  • @section_inline - Inline @section
@section('section', $content)
  • @layout
@layout('section')
  • @yield
@yield('content')
  • @trans - trans() helper
{{ trans('line') }}
  • @unless
@unless (condition)
@endunless
  • @url - url() helper
{{ url('line') }}
  • @csrf - csrf_field() (+ one empty lane after)
{{ csrf_field() }}
  • @while
@while (condition)
@endwhile
  • @push
@push('scripts')
@endpush
  • @stack
@stack('scripts')
  • @php
@php
@endphp
  • {!! - {!! raw data !!} (might be in conflict with internal Blade block tags)
{!! bla !!}
  • {{ - {{ data }} (might be in conflict with internal Blade block tags)
{{ bla }}
  • {{-- - comment (might be in conflict with internal Blade block tags)
{{-- bla --}}
  • @route - route() helper
{{ route('route.name') }}

Package Specific

This group contains all templates made for specific packages. This is an optional group. It has templates for my packages of choice. If you have your own stack of packages, please make templates by yourself.

@spaceless
@endspaceless
@group ('group_name')
@endgroup
@role ('role_name')
@endrole

Master plan

  • Rework all the templates in koomai/phpstorm-laravel-live-templates
  • Annotations
  • Blade
  • Input
  • Request
  • Cookie
  • Route
  • View
  • Response
  • Redirect
  • Schema
  • Cache
  • Form
  • Session
  • Helpers
  • Rework the documentation

About

Reworked famous live templates for Laravel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published