Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

laravel-blade-directives

> 后端框架
Open source

A collection of nice Laravel Blade directives

848 stars0 likes2 views
WebsiteGitHub

About

A collection of nice Laravel Blade directives

Laravel Blade Directives

A collection of nice Laravel Blade directives.

Installation

You can install the package via composer:

bash
composer require appstract/laravel-blade-directives

Usage

@istrue

Only show when $variable isset and true.

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

Or when you would like to quickly echo

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

@isfalse

Same as @istrue but checks for isset and false.

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

@isnull

Only show when $variable is null.

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

@isnotnull

Same as @isnull but one shows when $variable is not null.

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

@dump and @dd

blade
@dump($var)

@dd($var)

@mix

Create a HTML element to your Laravel-Mix css or js.

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

Output:

blade

@style

Create a element or element with a css path.

blade
@style
    body { background: black }
@endstyle

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

@script

Create a `

@endpushonce


Include pushes with standard `@stack` directive:

```blade
@stack('js')

@routeis

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

blade
@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.*

blade
@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.

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

@typeof

Checks if the parameter is of a certain type.

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

@repeat

Repeat something a specified amount of times.

blade
@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.

blade
@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.

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

@haserror

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

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

@count

Output number of entries.

blade
@count([1,2,3])

@nl2br

Replaces \n into .

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

@snake, @kebab, @camel

Output formatted string (uses Laravel Helpers).

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

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

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

Testing

bash
composer test

Contributing

Contributions are welcome, thanks to y'all :)

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.

License

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

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPbladedirectiveslaravellaravel-package

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架