Skip to content

JohnsDough/blade-extensions

 
 

Repository files navigation

Laravel logo Laravel Blade Extensions

Build Status GitHub Version Code Coverage Total Downloads License

Goto Documentation Goto API Documentation Goto Repository

Laravel ~4.2 5.0 5.1
Blade extensions v2.2 v3.0 v4.0

Laravel package providing additional Blade functionality. Thoroughly documented and 100% code coverage.

  • @set @unset Setting and unsetting of values
  • @foreach @break @continue Loop data and extras
  • @partial @block @render Creating view partials and blocks. Nest them, extend them, render them.
  • @debug @breakpoint Dump values and set breakpoints in views
  • @macro Defining and running macros (optional, requires laravelcollective/html)
  • @markdown Render github flavoured markdown with your preffered renderer by using the directives or view engine/compilers. (optional, requires erusev/parsedown or kzykhys/ciconia)
  • BladeString Render blade strings using the facade BladeString::render('my val: {{ $val }}', array('val' => 'foo'))

My other Laravel packages

Package Description
Themes L5 Theme package, providing multi-theme inherited cascading support. Works with PHP, Blade, Twig, etc. Includes asset management (Dependable assets or asset groups, caching, minification, etc), navigation & breadcrumb helpers and more. doc
Blade Extensions A collection of usefull Laravel blade extensions, like $loop data in foreach, view partials, etc doc

Installation

Requirements
"PHP": ">=5.5.9",
"illuminate/support": "~5.0"
Recommended
"laravelcollective/html": "~5.0",
"raveren/kint": ">=0.9.1",
"erusev/parsedown": "~1.5"
Composer
"radic/blade-extensions": "~4.0"
Laravel
Radic\BladeExtensions\BladeExtensionsServiceProvider::class

Some examples

Check the documentation for all features and options

@foreach($stuff as $key => $val)
    $loop->index;       // int, zero based
    $loop->index1;      // int, starts at 1
    $loop->revindex;    // int
    $loop->revindex1;   // int
    $loop->first;       // bool
    $loop->last;        // bool
    $loop->even;        // bool
    $loop->odd;         // bool
    $loop->length;      // int

    @foreach($other as $name => $age)
        $loop->parent->odd;
        @foreach($friends as $foo => $bar)
            $loop->parent->index;
            $loop->parent->parentLoop->index;
        @endforeach
    @endforeach
    
    
    @section('content')
        @partial('partials.danger-panel')
            @block('title', 'This is the panel title')
    
            @block('body')
                This is the panel body.
            @endblock
        @endpartial
    @stop
    
    @partial('partials.panel')
        @block('type', 'danger')
    
        @block('title')
            Danger! @render('title')
        @endblock
    @endpartial
    
    @break

    @continue
@endforeach

@set('newvar', 'value')
{{ $newvar }}


@debug($somearr)

Copyright/License

Copyright 2015 Robin Radic - MIT Licensed

About

Laravel Blade extensions like $loop->odd/$loop->index in foreach, view blocks and partials, etc

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%