PHPackages                             tilabs/manet - 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. tilabs/manet

ActiveLibrary

tilabs/manet
============

A fluent class builder for Laravel blade components.

v1.0.1(5mo ago)0249↓100%MITPHPPHP ^8.2

Since May 29Pushed 5mo agoCompare

[ Source](https://github.com/TILABS-CH/manet)[ Packagist](https://packagist.org/packages/tilabs/manet)[ RSS](/packages/tilabs-manet/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Manet by Tilabs
===============

[](#manet-by-tilabs)

> ⚡️ A simple and fluent way to add css classes to your Laravel blade components

[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)

**Requirements**

VersionPHP^8.2[Laravel](https://laravel.com)^12.0Installation &amp; Usage
------------------------

[](#installation--usage)

```
composer require tilabs/manet
```

Publish Test files

```
php artisan vendor:publish --tag=tilabs-manet-tests
```

Usage
-----

[](#usage)

Manet provides a `ManetManager` accessible via the `Manet` facade. The primary method you'll use is `classList()`, which returns a `ClassBuilder` instance.

### Basic Usage

[](#basic-usage)

```
use Tilabs\Manet\Facades\Manet;

// Simple class addition
$classes = Manet::classList()->add('p-4 rounded shadow');
// Output: "p-4 rounded shadow"

// Chaining add()
$classes = Manet::classList()
    ->add('text-blue-500')
    ->add('font-bold');
// Output: "text-blue-500 font-bold"

// Initial classes
$classes = Manet::classList('base-class another-base')
    ->add('extra-class');
// Output: "base-class another-base extra-class"
```

### Adding Multiple Classes

[](#adding-multiple-classes)

You can pass an array of classes to `add()`:

```
$classes = Manet::classList()->add(['p-4', 'bg-gray-100', 'rounded']);
// Output: "p-4 bg-gray-100 rounded"
```

### Conditional Classes with `add()`

[](#conditional-classes-with-add)

Leverage Laravel's array-to-CSS-classes format:

```
$isActive = true;
$hasError = false;

$classes = Manet::classList('btn')
    ->add([
        'btn-active' => $isActive,
        'btn-primary' => $isActive && !$hasError,
        'btn-danger' => $hasError,
        'opacity-50' => !$isActive,
    ]);
// If $isActive = true, $hasError = false: "btn btn-active btn-primary"
// If $isActive = false, $hasError = true: "btn btn-danger opacity-50"
```

### Conditional Logic with `when()`

[](#conditional-logic-with-when)

The `when()` method adds classes if the given condition is true.

```
$isPrimary = true;
$isLarge = false;

$classes = Manet::classList('button')
    ->when($isPrimary, 'button-primary')
    ->when($isLarge, 'button-large', 'button-medium'); // Optional default if condition is false

// If $isPrimary = true, $isLarge = false: "button button-primary button-medium"
```

#### `when()` with a Callable

[](#when-with-a-callable)

For more complex logic, pass a closure as the second argument. The closure will receive the `ClassBuilder` instance and the condition's result.

```
$userType = 'admin';

$classes = Manet::classList('user-profile')
    ->when($userType === 'admin', function ($classBuilder) {
        return $classBuilder->add('bg-red-500 text-white p-2');
    })
    ->when($userType === 'editor', function ($classBuilder) {
        return $classBuilder->add('bg-yellow-300 p-1');
    });

// If $userType = 'admin': "user-profile bg-red-500 text-white p-2"
```

### Conditional Logic with `unless()`

[](#conditional-logic-with-unless)

The `unless()` method is the inverse of `when()`. It adds classes if the given condition is false.

```
$isDisabled = false;

$classes = Manet::classList('form-input')
    ->unless($isDisabled, 'focus:ring-2 focus:ring-blue-500');

// If $isDisabled = false: "form-input focus:ring-2 focus:ring-blue-500"
```

#### `unless()` with a Callable

[](#unless-with-a-callable)

Similar to `when()`, `unless()` also supports callables.

```
$isComplete = true;

$classes = Manet::classList('task-item')
    ->unless($isComplete, function ($classBuilder) {
        return $classBuilder->add('border-l-4 border-orange-400');
    });

// If $isComplete = true: "task-item"
// If $isComplete = false: "task-item border-l-4 border-orange-400"
```

License
-------

[](#license)

Manet is open‑sourced software licensed under the **MIT license**.

###  Health Score

38

—

LowBetter than 86% of packages

Maintenance71

Regular maintenance activity

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~135 days

Total

2

Last Release

161d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/20d93a3f83d19dd9a3acb8cf11254ad68f2268c9c437bd2b1bc8f1ef2ffd1c67?d=identicon)[tilabs](/maintainers/tilabs)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/tilabs-manet/health.svg)

```
[![Health](https://phpackages.com/badges/tilabs-manet/health.svg)](https://phpackages.com/packages/tilabs-manet)
```

###  Alternatives

[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169175.3k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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