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

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

pyaesone17/active-state
=======================

Active State Checker For Laravel Url

v1.2(8y ago)4761.8k8[2 issues](https://github.com/pyaesone17/active-state/issues)[1 PRs](https://github.com/pyaesone17/active-state/pulls)MITPHP

Since Jan 14Pushed 4y ago2 watchersCompare

[ Source](https://github.com/pyaesone17/active-state)[ Packagist](https://packagist.org/packages/pyaesone17/active-state)[ Docs](https://github.com/pyaesone17/active-state)[ RSS](/packages/pyaesone17-active-state/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (12)Used By (0)

Active State
============

[](#active-state)

[![Total Downloads](https://camo.githubusercontent.com/a1f35d8acf225766b7d56bcffd480dbb3e0988032062efb18605f00dd692f8dc/68747470733a2f2f706f7365722e707567782e6f72672f70796165736f6e6531372f6163746976652d73746174652f646f776e6c6f616473)](https://packagist.org/packages/pyaesone17/active-state)[![License](https://camo.githubusercontent.com/69dd6431ec533fb61478e98285b618b33639728c43e6c0427b33ca55b7b62e54/68747470733a2f2f706f7365722e707567782e6f72672f70796165736f6e6531372f6163746976652d73746174652f6c6963656e7365)](https://packagist.org/packages/pyaesone17/active-state)[![Latest Stable Version](https://camo.githubusercontent.com/486c02fc351852032ed437cdbd4da97f6184a48ccdb7be07da391f5d8bba09ab/68747470733a2f2f706f7365722e707567782e6f72672f70796165736f6e6531372f6163746976652d73746174652f762f737461626c65)](https://packagist.org/packages/pyaesone17/active-state)[![Monthly Downloads](https://camo.githubusercontent.com/9b4cfca70d35fbe184a2c353f8d8317cf2c2805ce9d902e2f35b2e6d1afdaabf/68747470733a2f2f706f7365722e707567782e6f72672f70796165736f6e6531372f6163746976652d73746174652f642f6d6f6e74686c79)](https://packagist.org/packages/pyaesone17/active-state)

> Simple Laravel Active Checker For Request Url

Sometimes you want to check the request url is active or not For the following purpose. Especially for backend sidebar.

[![Bilby Stampede](https://camo.githubusercontent.com/d668055580818dde6d714e6b964579a7f329a9c2e847b519a9a4ddf7341afc24/687474703a2f2f7332322e706f7374696d672e6f72672f6163776d38396d66352f53656c656374696f6e5f3031312e706e67)](https://camo.githubusercontent.com/d668055580818dde6d714e6b964579a7f329a9c2e847b519a9a4ddf7341afc24/687474703a2f2f7332322e706f7374696d672e6f72672f6163776d38396d66352f53656c656374696f6e5f3031312e706e67)

Basically we do like this.

```
Post
Page
```

It would be nice if we can make shorter. right ?

```
Post
Page
```

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

[](#installation)

Install with `composer`:

Laravel 5.4 and above

```
composer require pyaesone17/active-state:^1.1.1

```

Laravel 5.3 and below

```
composer require pyaesone17/active-state:^0.0.2

```

And add the service provider in `config/app.php`

```
'providers' => [
    ........,
    Pyaesone17\ActiveState\ActiveStateServiceProvider::class,
]
```

If you want to use the facade, add this to your facades in `config/app.php`

```
'aliases' => [
    ........,
    'Active' => Pyaesone17\ActiveState\ActiveFacade::class,
]
```

To publish configuration file

```
php artisan vendor:publish --provider="Pyaesone17\ActiveState\ActiveStateServiceProvider"

```

Usage
-----

[](#usage)

It will check against whether your request is `www.url.com/data`If the request match this url . It will return the default value from config file. The default value for true state is `"active"` and false is `"no"`. You can configure on active.php .

```
{{ Active::check('data') }}
```

To check the exact url.

```
{{ Active::check('data') }} // check request is www.url.com/data
```

To check the url deeply , just pass the `true` value as second parameter.

```
{{ Active::check('data',true) }}  // check request is www.url.com/data || www.url.com/data/*
```

OR

```
{{ Active::check(['data','post','categories']) }}  // check request is www.url.com/data || www.url.com/post || www.url.com/categories
```

```
{{ Active::check(['data','post','categories'],true) }} // check request is www.url.com/data/* || // check request is www.url.com/post/* || www.url.com/categories/*
```

To change the return value in runtime, just pass the the third and fourth parameter.

```
{{ Active::check('data',true,'truth','fake') }} // it will override the value from config file.
```

Or you can even use helper function.

```
{{ active_check('data') }}
```

You can also use this package for conditional displaying data. In some case, You need to render some part of template depends on request.

```
@ifActiveUrl('data')
    Foo
@else
    Bar and Bazz
@endIfActiveUrl
```

Advance Usage and Above version 1.1.1
-------------------------------------

[](#advance-usage-and-above-version-111)

To check the route name is.

```
{{ Active::checkRoute('users.index') }} // check request url route name is "users.index"
```

OR

```
{{ Active::checkRoute(['users.index','users.show', 'users.edit']) }} // check request url route name is "users.index" or "users.show" or "users.edit"
```

Sometimes passing multiple routename as parameters is cubersome. You can simple do like this

```
{{ Active::checkRoute('users.*') }}
```

Ofcousre you may change the return value in runtime as second and third params.

```
{{ Active::checkRoute('users.index','routeIsActive','routeNotActive') }}
```

OR

```
{{ Active::checkRoute(['users.index','users.show'],'routeIsActive','routeNotActive') }}
```

For helper function.

```
{{ active_route('users.comments.*') }}
```

Yes it is also avaialable in blade.

```
@ifActiveRoute('users.index')
    Foo
@else
    Bar and Bazz
@endIfActiveRoute
```

To check the url with the exact same query paramter value.

```
{{ Active::checkQuery('users?gender=male') }} // check request is www.url.com/users?gender=male
```

OR

```
{{ Active::checkQuery(['users?gender=male','users?status=married']) }} // check request is www.url.com/users?gender=male or www.url.com/users?status=married
```

Ofcousre you may change the return value in runtime as second and third params.

```
{{ Active::checkQuery(['users?gender=male','itIsMale','Ah it is wonder woman') }}
```

OR

```
{{ Active::checkQuery(['users?gender=male','users?status=married'],'male or married','nothing') }}
```

For helper function.

```
{{ active_query('users?gender=male') }}
```

Yes it is also avaialable in blade.

```
@ifActiveQuery(['users?gender=male','users?status=married'])
    Foo
@else
    Bar and Bazz
@endIfActiveQuery
```

Notes
-----

[](#notes)

Everytime u update package, you have to run "php artisan view:clear" for blade directives.

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

[](#configuration)

You can configure the return value of active state.

```
return [

    // The default  value if the request match given action
    'active_state'      =>  'active',

    // The default  value if the request match given action
    'inactive_state'    =>  'no'

];
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~62 days

Recently: every ~23 days

Total

11

Last Release

3096d ago

Major Versions

0.0.3 → 1.0.02017-06-20

### Community

Maintainers

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

---

Top Contributors

[![pyaesone17](https://avatars.githubusercontent.com/u/11407146?v=4)](https://github.com/pyaesone17 "pyaesone17 (13 commits)")[![nyanwin](https://avatars.githubusercontent.com/u/7732452?v=4)](https://github.com/nyanwin "nyanwin (12 commits)")[![garbinmarcelo](https://avatars.githubusercontent.com/u/9335588?v=4)](https://github.com/garbinmarcelo "garbinmarcelo (1 commits)")[![llaski](https://avatars.githubusercontent.com/u/833579?v=4)](https://github.com/llaski "llaski (1 commits)")[![nayzawoo](https://avatars.githubusercontent.com/u/20064811?v=4)](https://github.com/nayzawoo "nayzawoo (1 commits)")

---

Tags

activeactive-statelaravellaravel-packageurl-checkrequestlaravelurl checkerdynamic url

### Embed Badge

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

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

###  Alternatives

[stephenjude/filament-blog

Filament Blog Builder

20316.9k](/packages/stephenjude-filament-blog)

PHPackages © 2026

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