PHPackages                             pskordilakis/blade-class-directive - 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. pskordilakis/blade-class-directive

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

pskordilakis/blade-class-directive
==================================

Laravel blade class directive

v1.0.1(6y ago)41.2k2[1 PRs](https://github.com/pskordilakis/blade-class-directive/pulls)MITPHPPHP &gt;=7.2

Since May 5Pushed 1y ago2 watchersCompare

[ Source](https://github.com/pskordilakis/blade-class-directive)[ Packagist](https://packagist.org/packages/pskordilakis/blade-class-directive)[ Docs](https://github.com/pskordilakis/blade-class-directive)[ RSS](/packages/pskordilakis-blade-class-directive/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (4)Used By (0)

Blade Class Directive
=====================

[](#blade-class-directive)

Inspired by [classnames](https://github.com/JedWatson/classnames) for react.

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

[](#installation)

```
composer require pskordilakis/blade-class-directive
```

Usage
-----

[](#usage)

@class directive accepts a variable number of arguments that can be of type string or array and returns(prints) a class attribute for an HTML element. Any string argument will be added as part of the value of the class attribute. For the array arguments, the entries will be filtered based on the value (truthy/falsy) and the key will be added to the class value

### String arguments

[](#string-arguments)

```
@class('btn btn-primary')
```

### Array Arguments

[](#array-arguments)

```
@class([ 'btn' => true, 'btn-primary' => true, 'disabled' => $isDisabled ])
```

### Mixed Arguments

[](#mixed-arguments)

```
@class('btn btn-primary', [ 'disabled' => $isDisabled ])
```

### On HTML elements

[](#on-html-elements)

```
 $pagination->onFirstPage() ])>
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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.

###  Release Activity

Cadence

Every ~27 days

Total

2

Last Release

2535d ago

### Community

Maintainers

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

---

Top Contributors

[![pskordilakis](https://avatars.githubusercontent.com/u/15627750?v=4)](https://github.com/pskordilakis "pskordilakis (3 commits)")[![hatwheels](https://avatars.githubusercontent.com/u/12772651?v=4)](https://github.com/hatwheels "hatwheels (1 commits)")[![priithansen](https://avatars.githubusercontent.com/u/1476082?v=4)](https://github.com/priithansen "priithansen (1 commits)")

---

Tags

laravelclassbladedirectiveclassnames

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pskordilakis-blade-class-directive/health.svg)

```
[![Health](https://phpackages.com/badges/pskordilakis-blade-class-directive/health.svg)](https://phpackages.com/packages/pskordilakis-blade-class-directive)
```

###  Alternatives

[spatie/laravel-blade-javascript

A Blade directive to export variables to JavaScript

638855.8k9](/packages/spatie-laravel-blade-javascript)[robsontenorio/mary

Gorgeous UI components for Livewire powered by daisyUI and Tailwind

1.5k454.7k15](/packages/robsontenorio-mary)[stijnvanouplines/blade-country-flags

A package to easily make use of country flags in your Laravel Blade views.

26307.2k6](/packages/stijnvanouplines-blade-country-flags)[saade/blade-iconsax

A package to easily make use of Iconsax in your Laravel Blade views.

21138.5k](/packages/saade-blade-iconsax)

PHPackages © 2026

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