PHPackages                             stechstudio/laravel-route-context - 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. [API Development](/categories/api)
4. /
5. stechstudio/laravel-route-context

ActiveLibrary[API Development](/categories/api)

stechstudio/laravel-route-context
=================================

Provide additional route context that gets treated as normal route parameters

0.1(4y ago)03MITPHPPHP ^8.0

Since Jan 6Pushed 4y ago2 watchersCompare

[ Source](https://github.com/stechstudio/laravel-route-context)[ Packagist](https://packagist.org/packages/stechstudio/laravel-route-context)[ Docs](https://github.com/stechstudio/laravel-route-context)[ RSS](/packages/stechstudio-laravel-route-context/feed)WikiDiscussions main Synced 1mo ago

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

Route context in Laravel
========================

[](#route-context-in-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bf7b8f1be1bf3b8ef5f391801ef0a0f8486db767506d260eff531dfb6fd62a28/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737465636873747564696f2f6c61726176656c2d726f7574652d636f6e746578742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stechstudio/laravel-route-context)

This is a super small package that enables you to provide additional context to your routes. Any context variables you specify will be treated as route parameters.

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

[](#installation)

You know the drill...

```
composer require stechstudio/laravel-route-context
```

Usage
-----

[](#usage)

The idea is that sometimes you want to reuse a controller method or Livewire fullpage component, while providing additional context at the routing layer.

Imagine you need to list support tickets, and you have a controller and view that handles this. You have multiple endpoints where tickets might be displayed in a slightly different manner.

With this package you can specify additional context right alongside your routes like this:

```
Route::get('tickets', [TicketController::class, 'index']);
Route::get('tickets/archived', [TicketController::class, 'index'])->with([
    'archived' => true
]);
Route::get('tickets/mine', [TicketController::class, 'index'])->with([
    'user' => fn() => auth()->user()
]);
Route::get('tickets/{user}', [TicketController::class, 'index']);
```

Now in your `TicketController` you can inject your context variables, just as if they had been route parameters:

```
public function index(User $user, $archived = false) {
    $tickets = Tickets::query()
        ->when($user->exists, fn($q) => $q->where('user_id', $user->id))
        ->when(!$archived, fn($q) => $q->whereNull('archived_at'))
        ->paginate();
}
```

Notice that context values can be callbacks, if you need it evaluated after your app has bootstrapped, session is started, auth is available, etc.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

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

Unknown

Total

1

Last Release

1584d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/315be5f111b5501a41b99a0205c9c85915335391168a0ed10316546a1a38bbd8?d=identicon)[jszobody](/maintainers/jszobody)

---

Top Contributors

[![jszobody](https://avatars.githubusercontent.com/u/203749?v=4)](https://github.com/jszobody "jszobody (3 commits)")

---

Tags

laravelstechstudiolaravel-route-context

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stechstudio-laravel-route-context/health.svg)

```
[![Health](https://phpackages.com/badges/stechstudio-laravel-route-context/health.svg)](https://phpackages.com/packages/stechstudio-laravel-route-context)
```

###  Alternatives

[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)

PHPackages © 2026

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