PHPackages                             googleshokry/laravel-blade-directives - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. googleshokry/laravel-blade-directives

ActiveLibrary[Templating &amp; Views](/categories/templating)

googleshokry/laravel-blade-directives
=====================================

Handy Blade directives

05PHP

Since Oct 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/googleshokry/laravel-blade-directives)[ Packagist](https://packagist.org/packages/googleshokry/laravel-blade-directives)[ RSS](/packages/googleshokry-laravel-blade-directives/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Blade Directives
========================

[](#laravel-blade-directives)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6517339b98d2ba24baba09c059d94e4d9bb9be48f48a47bde9691303365524ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f6f676c6573686f6b72792f6c61726176656c2d626c6164652d646972656374697665732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/googleshokry/laravel-blade-directives)[![Total Downloads](https://camo.githubusercontent.com/7f4b97fe1459381195d8c5784a88cedaf6ce50181e7fc20422f763b658fbbf41/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676f6f676c6573686f6b72792f6c61726176656c2d626c6164652d646972656374697665732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/googleshokry/laravel-blade-directives)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/043b0ee66c56e0cb178d396aa3d876ff97e156aaf38e073ab80a9013dd27f0b9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f676f6f676c6573686f6b72792f6c61726176656c2d626c6164652d646972656374697665732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/googleshokry/laravel-blade-directives)

A collection of nice Laravel Blade directives.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require googleshokry/laravel-blade-directives
```

Usage
-----

[](#usage)

### @istrue

[](#istrue)

Only show when `$variable` isset and true.

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

Or when you would like to quickly echo

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

### @isfalse

[](#isfalse)

Same as `@istrue` but checks for isset and false.

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

### @isnull

[](#isnull)

Only show when `$variable` is null.

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

### @isnotnull

[](#isnotnull)

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

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

### @dump and @dd

[](#dump-and-dd)

```
@dump($var)

@dd($var)
```

### @mix

[](#mix)

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

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

Output:

```

```

### @style

[](#style)

Create a `` element or `` element with a css path.

```
@style
    body { background: black }
@endstyle

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

### @script

[](#script)

Create a `` element with or without a js path.

```
@script
    alert('hello world')
@endscript

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

### @inline

[](#inline)

Load the contents of a css or js file inline in your view.

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

### @pushonce

[](#pushonce)

Same as `@push` but will include content one time only. Useful for repeatable blocks.

First parameter must follow the syntax `stack-name:group-name`.

```
@pushonce('js:foobar')

@endpushonce
```

Include pushes with standard `@stack` directive:

```
@stack('js')
```

### @routeis

[](#routeis)

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

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

### @routeisnot

[](#routeisnot)

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

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

### @instanceof

[](#instanceof)

Checks if the first parameter is an instance of the second parameter.

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

### @typeof

[](#typeof)

Checks if the parameter is of a certain type.

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

### @repeat

[](#repeat)

Repeat something a specified amount of times.

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

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

[](#fa-fas-far-fal-fab-mdi-glyph)

Quickly output an icon with Font Awesome, Material Design Icons or Glyphicon.

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

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

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

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

### @data

[](#data)

Output data-attributes from an array.

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

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Contributions are welcome, [thanks to y'all](https://github.com/googleshokry/laravel-blade-directives/graphs/contributors) :)

About GoogleShokry
------------------

[](#about-googleshokry)

GoogleShokry is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on [Medium](https://medium.com/googleshokry). You can [follow us on Twitter](https://twitter.com/googleshokry), [buy us a beer](https://www.paypal.me/googleshokry/10) or [support us on Patreon](https://www.patreon.com/googleshokry).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e96c062494bfb776a10cb236e9b56451617925f7e30828ea8df6e4569c0e5e9d?d=identicon)[googleshokry](/maintainers/googleshokry)

---

Top Contributors

[![googleshokry](https://avatars.githubusercontent.com/u/7471802?v=4)](https://github.com/googleshokry "googleshokry (2 commits)")

### Embed Badge

![Health badge](/badges/googleshokry-laravel-blade-directives/health.svg)

```
[![Health](https://phpackages.com/badges/googleshokry-laravel-blade-directives/health.svg)](https://phpackages.com/packages/googleshokry-laravel-blade-directives)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
