PHPackages                             schivei/laravel-tag-helper - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. schivei/laravel-tag-helper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

schivei/laravel-tag-helper
==========================

Add powerful HTML tag helpers to your Laravel application

v1.0.6(1y ago)011[1 PRs](https://github.com/schivei/laravel-tag-helper/pulls)MITPHPPHP ^8.2

Since Aug 25Pushed 1y agoCompare

[ Source](https://github.com/schivei/laravel-tag-helper)[ Packagist](https://packagist.org/packages/schivei/laravel-tag-helper)[ Docs](https://github.com/schivei/laravel-tag-helper)[ RSS](/packages/schivei-laravel-tag-helper/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (6)Versions (9)Used By (0)

Laravel Tag Helpers
===================

[](#laravel-tag-helpers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/715bfbde15c3c96fb0ca33668e72bf512d64b6dacbb25bae4d1f793bb5949558/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736368697665692f6c61726176656c2d7461672d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/schivei/laravel-tag-helper)[![Build Status](https://github.com/schivei/laravel-tag-helper/actions/workflows/php.yml/badge.svg)](https://github.com/schivei/laravel-tag-helper/actions/workflows/php.yml)[![codecov](https://camo.githubusercontent.com/f302f16dfe145377e2ed6250f6031afa9d513444483c7dddd3e0e9caabbf5f03/68747470733a2f2f636f6465636f762e696f2f67682f736368697665692f6c61726176656c2d7461672d68656c7065722f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4b464235415542555352)](https://codecov.io/gh/schivei/laravel-tag-helper)[![Total Downloads](https://camo.githubusercontent.com/9a4db64216ee2c6f054d8b50713a15a92ceb17afdaa96ee05e630b86975a753d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736368697665692f6c61726176656c2d7461672d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/schivei/laravel-tag-helper)

This package allows you to register custom "tag helpers" in your Laravel application. These helpers can modify the HTML code.

> It is a fork of [beyondcode/laravel-tag-helper](https://github.com/beyondcode/laravel-tag-helper)

What the difference between this package and the original one?
--------------------------------------------------------------

[](#what-the-difference-between-this-package-and-the-original-one)

This package is focused on element attributes, while the original proposes to implement custom elements. This package also has a better test coverage and a more robust codebase.

To use custom elements, try to create Blade Components instead.

Why should I use this package?
------------------------------

[](#why-should-i-use-this-package)

To create shortcuts for common HTML patterns and reduce the double bracket usage in your Blade templates.

Built-In Helpers
----------------

[](#built-in-helpers)

### CSRF Token

[](#csrf-token)

Instead of writing this:

```

```

You can write this:

```

```

### Form Method

[](#form-method)

Instead of writing this:

```

```

You can write this:

```

```

### Link

[](#link)

Instead of writing this:

```
Home
```

You can write this:

```
Home
```

### Assets

[](#assets)

Instead of writing this:

```

```

You can write this:

```

```

### Conditional Attributes

[](#conditional-attributes)

Instead of writing this:

```
@if($condition)

@endif

@isset($condition)

@endisset

@empty($condition)

@endempty

@unless($condition)

@endunless
```

You can write this:

```

```

NOTE: `else` and `elseif` are not supported.

### Guest and Auth

[](#guest-and-auth)

Instead of writing this:

```
@auth("web")

@endauth

@auth($what)

@endauth

@guest("web")

@endguest

@guest($what)

@endguest
```

You can write this:

```

```

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

[](#installation)

You can install the package via composer:

```
composer require schivei/laravel-tag-helper
```

Usage
-----

[](#usage)

You can create your own Tag Helper, by creating a new class and extend from the `Schivei\TagHelper\Helper` class. Within this class you can define on which HTML elements and attributes your helper should be triggered:

```
