PHPackages                             cocomelon/laravel-active-state - 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. cocomelon/laravel-active-state

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

cocomelon/laravel-active-state
==============================

A Laravel package to manage active states easily

v1.0.1(8mo ago)011MITPHPPHP ^7.4|^8.0

Since Sep 2Pushed 8mo agoCompare

[ Source](https://github.com/vinayak-ukkoji/laravel-active-state)[ Packagist](https://packagist.org/packages/cocomelon/laravel-active-state)[ RSS](/packages/cocomelon-laravel-active-state/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Active State
====================

[](#laravel-active-state)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1a7768444552d743f1c869c700a9813b27a4a27cc45abb16eaca71cfb3ee4a50/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f636f6d656c6f6e2f6c61726176656c2d6163746976652d73746174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cocomelon/laravel-active-state)[![License](https://camo.githubusercontent.com/396b4c2b4fc32e5edae68f195603fca476f35b03c87131231ef8218a8fa6d609/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f636f6d656c6f6e2f6c61726176656c2d6163746976652d73746174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cocomelon/laravel-active-state)

A simple Laravel package to manage active CSS classes in Blade templates based on current route.

Features
--------

[](#features)

- Easily add an "active" class to menu items or links in Blade.
- Configurable active CSS class name.
- Supports route pattern matching.

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

[](#installation)

You can install the package via Composer:

```
composer require cocomelon/laravel-active-state
```

Optionally, publish the config file to customize the active class name:

```
php artisan vendor:publish --tag=config

```

This will create a config file at config/activestate.php.

Configuration
-------------

[](#configuration)

The config file contains:

```
return [
    /*
    |--------------------------------------------------------------------------
    | CSS class for active state
    |--------------------------------------------------------------------------
    |
    | This class will be output by the @active Blade directive when
    | the current route matches the given pattern.
    |
    */

    'active_class' => 'active',
    ];

```

Change 'active' to whatever CSS class you want.

Usage
-----

[](#usage)

Use the Blade directive @active in your views to add the active class based on current route name.

```
Example:

Home
Posts

```

This will output active (or your configured class) if the current route matches.

How it works

Behind the scenes, @active('route.name') translates to:

```

```

License

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

Made with ❤️ by Cocomelon

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance60

Regular maintenance activity

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

252d ago

### Community

Maintainers

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

---

Top Contributors

[![pawarTester](https://avatars.githubusercontent.com/u/159274465?v=4)](https://github.com/pawarTester "pawarTester (8 commits)")[![vinayak-ukkoji](https://avatars.githubusercontent.com/u/56839503?v=4)](https://github.com/vinayak-ukkoji "vinayak-ukkoji (1 commits)")

### Embed Badge

![Health badge](/badges/cocomelon-laravel-active-state/health.svg)

```
[![Health](https://phpackages.com/badges/cocomelon-laravel-active-state/health.svg)](https://phpackages.com/packages/cocomelon-laravel-active-state)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

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

PHPackages © 2026

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