https://github.com/permafrost-dev/laravel-current-route
Laravel helper functions and classes related to the current/active route.
https://github.com/permafrost-dev/laravel-current-route
laravel laravel-package laravel-routes
Last synced: about 1 month ago
JSON representation
Laravel helper functions and classes related to the current/active route.
- Host: GitHub
- URL: https://github.com/permafrost-dev/laravel-current-route
- Owner: permafrost-dev
- License: mit
- Created: 2020-07-21T22:09:03.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-22T16:55:12.000Z (almost 6 years ago)
- Last Synced: 2025-01-23T15:32:00.280Z (over 1 year ago)
- Topics: laravel, laravel-package, laravel-routes
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Laravel Current Route
---
Helper functions and class to retrieve information about the current route in Laravel.

---
#### Installation
You can install the package via composer:
```bash
composer require permafrost-dev/laravel-current-route
```
---
#### Helper Functions
```php
// Return a Laravel Route object for the current route.
function current_route();
// Return a class containing information about the current route.
function current_route_info();
// Return the action for the current route.
function current_route_action();
// Return true if one of the specified wildcard patterns matches the name of the current route.
function current_route_matches($patterns);
// Return the name for the current route.
function current_route_name();
// Returns true if $name matches the name of the current route.
function current_route_named($name);
```
#### Usage
_WIP_
#### Examples
Use `current_route_named()` to generate conditional css classes in a blade template:
```html
Dashboard
```
---
#### Testing
``` bash
$ vendor/bin/phpunit
```
---
#### License
The MIT License (MIT). Please see the [License File](LICENSE) for more information.