Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Active Laravel Package

hieu-le/active

Laravel helper for detecting the active state of routes URLs and requests, making it easy to highlight the current menu item, tab, or link in your navigation. Provides simple isActive methods and Blade-friendly checks with flexible pattern matching.

View on GitHub
Deep Wiki
Context7

hieu-le/active is a lightweight Laravel package that helps you highlight the active menu item or navigation link based on the current route or request. It provides a clean, fluent API so you can mark links as active without scattering conditional logic throughout your Blade templates.

  • Detect active state by route name, URL pattern, or controller action
  • Fluent helpers like isActiveRoute() and isActiveElement() for Blade views
  • Supports wildcards and multiple patterns for flexible matching
  • Works with named routes, query strings, and nested navigation
  • Minimal configuration, drop-in integration with existing Laravel apps
Frequently asked questions about Active
How do I install hieu-le/active in a Laravel application?
Run composer require hieu-le/active and let Laravel package auto-discovery register the service provider; no config file, migrations, or published assets are involved. On older Laravel versions without auto-discovery, add the provider and the Active facade alias to config/app.php manually. After that the active_class() helper and the Active facade are available in your Blade templates immediately.
Which Laravel and PHP versions does hieu-le/active support?
The package's composer.json is the only authority: check the illuminate/support and php constraints before committing to it. The last tagged release was March 2022, so it was built for the Laravel 5.x through 9.x era and carries no compatibility commitment beyond that. Confirm it admits the Laravel and PHP versions you plan to run for the next 18 months, especially if a Laravel 10 or 11 upgrade is on your roadmap.
How do I add an active class to a navigation link in Blade?
Call the active_class() helper or Active::getActiveClass() inside your nav markup and echo the returned CSS class onto the anchor or list item. You pass the route name, URI, controller, or action that should match the current request. Because the package only returns a string, it works in any Blade template and is easy to assert against in feature tests that inspect rendered markup.
What is the difference between Active::isActive() and Active::getActiveClass()?
Active::isActive() answers a boolean question: does the current route match the given pattern? Active::getActiveClass() returns the configured CSS class on a match and a default, usually an empty string, when there is none. Use isActive() when you need to branch in the template, for example to also set aria-current, and getActiveClass() when you simply want to echo a class attribute.
Can I match routes by controller and action instead of route name?
Yes, the package can match by controller and action as well as by route name and URI. That is convenient early on but degrades silently after route refactors, because a renamed controller or action simply stops matching and no exception is thrown. Prefer route-name matching, and add a test that asserts the rendered active class so a broken match fails loudly.
Is hieu-le/active still maintained, and is it safe for production?
The upstream repository is archived and the last release dates to March 2022, so there is no active maintainer and no commitment to fix breakage on newer Laravel releases. Security exposure is low because the package performs no I/O, deserialization, or dynamic execution; the real risk is maintenance and upgrade friction. Treat support as your own team's responsibility and plan an exit path.
Why is my active class missing after running route:cache?
Active-route detection compares the current request against patterns, and once routes are cached Laravel resolves them from the compiled route collection instead of re-registering them per request. Matching usually still works, but anything relying on registration-time behaviour or on artifacts that are not part of the cached routes can stop matching. Validate your navigation against a route:cache run in staging and prefer route-name matching, which survives caching.
Does hieu-le/active work with Laravel 10 or Laravel 11?
Probably not out of the box. The decisive factor is the illuminate/support constraint in its composer.json, and since the package has not been updated since March 2022 it most likely pins to the Laravel 5.x through 9.x range. Forcing an install with --ignore-platform-reqs is a poor trade for a dependency whose only job is adding a CSS class. A small fork or a swap to request()->routeIs() is cheaper.
How do I replace hieu-le/active with native Laravel features?
Laravel now covers everything this package does through request()->routeIs(), Route::is(), and the @class directive for name, URI, and pattern matching in Blade. Introduce an app-owned shim such as a small ActiveNav class or an @active Blade directive built on routeIs(), keep your existing call sites unchanged, then remove the package, its provider, and its facade alias. It is a mechanical codemod rather than a template rewrite.
Can hieu-le/active conflict with my own helper functions or other packages?
The package registers global helper functions through Composer's files autoload, so they are defined at autoload time rather than lazily on first call. If your application or another package declares a function with the same name, you get a fatal redeclaration error at boot instead of a recoverable failure at the call site. Grep your dependency tree for active_class and the Active alias before installing.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core