2017 © Pedro Peláez
 

library laravel-blade-directives

Handy Blade directives

image

appstract/laravel-blade-directives

Handy Blade directives

  • Tuesday, June 12, 2018
  • by gizburdt
  • Repository
  • 22 Watchers
  • 475 Stars
  • 55,573 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 36 Forks
  • 1 Open issues
  • 25 Versions
  • 42 % Grown

The README.md

Laravel Blade Directives

Latest Version on Packagist Total Downloads Software License Build Status, (*1)

A collection of nice Laravel Blade directives., (*2)

Installation

You can install the package via composer:, (*3)

composer require appstract/laravel-blade-directives

Usage

@istrue

Only show when $variable isset and true., (*4)

@istrue($variable)
   This will be echoed
@endistrue

Or when you would like to quickly echo, (*5)

@istrue($variable, 'This will be echoed')

@isfalse

Same as @istrue but checks for isset and false., (*6)

@isfalse($variable)
   This will be echoed
@endisfalse

@isnull

Only show when $variable is null., (*7)

@isnull($variable)
   This will be echoed
@endisnull

@isnotnull

Same as @isnull but one shows when $variable is not null., (*8)

@isnotnull($variable)
   This will be echoed
@endisnotnull

@dump and @dd

@dump($var)

@dd($var)

@mix

Create a HTML element to your Laravel-Mix css or js., (*9)

@mix('/css/app.css')
@mix('/js/app.js')

Output:, (*10)

<link rel="stylesheet" href="{{ mix('/css/app.css') }}">
<script src="{{ mix('/js/app.js') }}"></script>

@style

Create a <style> element or <link> element with a css path., (*11)

@style
    body { background: black }
@endstyle


@style('/css/app.css')

@script

Create a <script> element with or without a js path., (*12)

@script
    alert('hello world')
@endscript


@script('/js/app.js')

@inline

Load the contents of a css or js file inline in your view., (*13)

@inline('/js/manifest.js')

@pushonce

Same as @push but will include content one time only. Useful for repeatable blocks., (*14)

First parameter must follow the syntax stack-name:group-name., (*15)

@pushonce('js:foobar')
    <script src="{{ asset('/js/foobar.js') }}"></script>
@endpushonce

Include pushes with standard @stack directive:, (*16)

@stack('js')

@routeis

Checks if the current route name is equal to the given parameter. You can use a wildcard like blog.post.*., (*17)

@routeis('webshop.checkout')
    Do something only on the checkout
@endrouteis

@routeisnot

Checks if the current route name is not equal to the given parameter. You can use a wildcard like blog.post.*, (*18)

@routeisnot('webshop.checkout')
    Do something only if this is not the checkout
@endrouteisnot

@instanceof

Checks if the first parameter is an instance of the second parameter., (*19)

@instanceof($user, 'App\User')
    User is an instance of App\User
@endinstanceof

@typeof

Checks if the parameter is of a certain type., (*20)

@typeof($text, 'string')
    Text is a string
@endtypeof

@repeat

Repeat something a specified amount of times., (*21)

@repeat(3)
    Iteration #{{ $iteration }}
@endrepeat

@fa, @fas, @far, @fal, @fab, @fad, @mdi, @glyph

Quickly output an icon with Font Awesome, Material Design Icons or Glyphicon., (*22)

@fa('address-book', 'optional-extra-class')

// for Font Awesome 5 (solid, regular, light, brand, duotone):
@fas('address-book', 'optional-extra-class')
@far('address-book', 'optional-extra-class')
@fal('address-book', 'optional-extra-class')
@fab('address-book', 'optional-extra-class')
@fad('address-book', 'optional-extra-class')

// for Material Design Icons
@mdi('account', 'optional-extra-class')

// for Glyphicons
@glyph('glass', 'optional-extra-class')

@data

Output data-attributes from an array., (*23)

@data(['testing' => 123])

@haserror

Quickly output for classical $errors->has('input_name') to determine if any error messages exist for a given field., (*24)

@haserror('input_name')
    This input has an error
@endhaserror

@count

Output number of entries., (*25)

@count([1,2,3])

@nl2br

Replaces \n into <br>., (*26)

@nl2br('foo\n bar\n baz\n')

@snake, @kebab, @camel

Output formatted string (uses Laravel Helpers)., (*27)

@snake('fooBar')
// output: 'foo_bar'

@kebab('fooBar')
// output: 'foo-bar'

@camel('foo bar')
// output: 'fooBar'

Testing

composer test

Contributing

Contributions are welcome, thanks to y'all :), (*28)

About Appstract

Appstract is a small team from The Netherlands. We create (open source) tools for Web Developers and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon., (*29)

License

The MIT License (MIT). Please see License File for more information., (*30)

The Versions

12/06 2018

dev-master

9999999-dev https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

 

The Development Requires

appstract laravel-blade-directives

31/05 2018

1.1.0

1.1.0.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

 

The Development Requires

appstract laravel-blade-directives

26/03 2018

1.0.0

1.0.0.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

 

The Development Requires

appstract laravel-blade-directives

26/03 2018

dev-analysis-8QWJo3

dev-analysis-8QWJo3 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

 

The Development Requires

appstract laravel-blade-directives

08/01 2018

0.7.1

0.7.1.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

09/11 2017

dev-analysis-8jdxgJ

dev-analysis-8jdxgJ https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

09/11 2017

0.7.0

0.7.0.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

13/10 2017

0.6.0

0.6.0.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

12/10 2017

0.5.3

0.5.3.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

11/10 2017

0.5.2

0.5.2.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

09/10 2017

0.5.1

0.5.1.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

09/10 2017

0.5.0

0.5.0.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

09/10 2017

0.4.6

0.4.6.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

04/10 2017

0.4.5

0.4.5.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

29/06 2017

0.4.4

0.4.4.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

28/06 2017

0.4.3

0.4.3.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

27/06 2017

0.4.2

0.4.2.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

27/06 2017

0.4.1

0.4.1.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

20/06 2017

0.4.0

0.4.0.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

15/06 2017

0.3.0

0.3.0.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

14/06 2017

0.2.2

0.2.2.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

07/06 2017

0.2.1

0.2.1.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

appstract laravel-blade-directives

04/06 2017

0.2.0

0.2.0.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

appstract laravel-blade-directives

03/06 2017

0.1.1

0.1.1.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

appstract laravel-blade-directives

03/06 2017

0.1.0

0.1.0.0 https://github.com/appstract/laravel-blade-directives

Handy Blade directives

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

appstract laravel-blade-directives