PHPackages                             imi/laravel-transsid - 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. imi/laravel-transsid

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

imi/laravel-transsid
====================

Trans\_SID (Session IDs in URLs) for Laravel 5-8 Projects

5.1.1(1y ago)183.5k9[2 issues](https://github.com/iMi-digital/laravel-transsid/issues)GPL-2.0-or-laterPHP

Since Jun 16Pushed 1y ago4 watchersCompare

[ Source](https://github.com/iMi-digital/laravel-transsid)[ Packagist](https://packagist.org/packages/imi/laravel-transsid)[ RSS](/packages/imi-laravel-transsid/feed)WikiDiscussions master Synced today

READMEChangelog (10)DependenciesVersions (22)Used By (0)

Encode Session IDs in URLs for Laravel 5-10 Projects (Transparent SID)
======================================================================

[](#encode-session-ids-in-urls-for-laravel-5-10-projects-transparent-sid)

This module adds support for keeping session IDs (as normally stored in session cookies) to all URLs. This is especially useful if your application runs in Iframe as some browser block cookies in those. PHP already provides the `session.use_trans_sid` configuration value for this, but as Laravel 5 is implementing sessions in its on way, our module is necessary.

Compatibility
-------------

[](#compatibility)

Laravel VersionPackage Version5.x - 6.x27+3Installation
------------

[](#installation)

1. Install `imi/laravel-transsid` via composer.
2. In your `config/app.php` at `providers` replace `'Illuminate\Session\SessionServiceProvider'` with `\iMi\LaravelTransSid\SessionServiceProvider::class`
3. Add `\iMi\LaravelTransSid\UrlServiceProvider::class` at the end of the providers array
4. (optional) In your `app/Http/Kernel.php` add `'urlsession' => \iMi\LaravelTransSid\UrlSession::class` to the `$routeMiddleware` array.

In recent Laravel versions, the service provider is replaced like this:

```
'providers' => ServiceProvider::defaultProviders()
    ->replace([
        '\Illuminate\Session\SessionServiceProvider::class' => \iMi\LaravelTransSid\SessionServiceProvider::class,
    ])
```

Usage
-----

[](#usage)

To use SessionIDs in URLs add the middleware `urlsession` (if you registered the middleware globally) or add the `\iMi\LaravelTransSid\UrlSession::class` class directly to your route or routegroup.

URLs generated with Laravel's URL function (for example `URL::to()`) will now have a session ID appended.

If direct path's are or the `previous()` method is used, the SID is always added, because no route is known. If you would like to generate URLs without a session ID, add a `NO_ADD_SID` parameter:

```
{{ URL::to('/', ['NO_ADD_SID' => true]) }}

```

Livewire Support
----------------

[](#livewire-support)

To include session ids when using Livewire, add this script to your page:

```

    document.addEventListener('livewire:load', function(event) {
        Livewire.addHeaders({
            'X-session': '{{ Session::getId() }}',
        })
    });

```

For Livewire 3

```
@script

    Livewire.hook('request', ({ options }) => {
        options.headers['X-session'] = '{{ Session::getId() }}';
    })

@endscript

```

You eventually need to disable CSRF token validation - don't do this for administrative pages / pages with login.

If using livewire you might want to omit registering `\Illuminate\Session\SessionServiceProvider::class` and use the `StartSessionMiddle` in your `Kernel.php`

Seperation betweend Frontend and Admin
--------------------------------------

[](#seperation-betweend-frontend-and-admin)

Don't use this for login areas. Use it only for afrontend without sensitive data.

You could use different middleware groups in the `Kernel.php`

```
 protected $middlewareGroups = [
     'web' => [
         \iMi\LaravelTransSid\UrlSession::class,
         \iMi\LaravelTransSid\StartSessionMiddleware::class,
         \Illuminate\View\Middleware\ShareErrorsFromSession::class,
         \Illuminate\Routing\Middleware\SubstituteBindings::class,
     ],

     'web_admin' => [
         \App\Http\Middleware\EncryptCookies::class,
         \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
         \Illuminate\Session\Middleware\StartSession::class,
         \Illuminate\View\Middleware\ShareErrorsFromSession::class,
         \App\Http\Middleware\VerifyCsrfToken::class,
         \Illuminate\Routing\Middleware\SubstituteBindings::class,
     ],
```

Force cookie-off in IFrame
--------------------------

[](#force-cookie-off-in-iframe)

If you application is only used in IFrames you might get "cookie was rejectes" warnings by browsers. You can use `StartSessionCookielessMiddleware` in such cases which never sends a cookie.

Warning
-------

[](#warning)

Session IDs in URLs are easier to steal than a session cookie.

About Us
========

[](#about-us)

[iMi digital GmbH](http://www.imi.de/) offers Laravel related open source modules. If you are confronted with any bugs, you may want to open an issue here.

In need of support or an implementation of a modul in an existing system, [free to contact us](mailto:digital@iMi.de). In this case, we will provide full service support for a fee.

Of course we provide development of closed-source modules as well.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

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

Every ~185 days

Recently: every ~65 days

Total

20

Last Release

505d ago

Major Versions

1.2.0 → 2.0.02015-10-20

2.0.1 → 3.0.02021-03-25

3.0.2 → 4.0.02022-07-25

4.3.2 → 5.0.02024-05-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e83b21f6b852a0a527372174187cc61c74cbbfbdb34df74816ef77736224fff?d=identicon)[imi](/maintainers/imi)

---

Top Contributors

[![amenk](https://avatars.githubusercontent.com/u/1087128?v=4)](https://github.com/amenk "amenk (27 commits)")[![anhofmann](https://avatars.githubusercontent.com/u/3919068?v=4)](https://github.com/anhofmann "anhofmann (5 commits)")[![iSteuding](https://avatars.githubusercontent.com/u/142582530?v=4)](https://github.com/iSteuding "iSteuding (3 commits)")[![andreascreten](https://avatars.githubusercontent.com/u/4200?v=4)](https://github.com/andreascreten "andreascreten (3 commits)")[![Lucas-Schmukas](https://avatars.githubusercontent.com/u/89397256?v=4)](https://github.com/Lucas-Schmukas "Lucas-Schmukas (3 commits)")[![nachtsheim](https://avatars.githubusercontent.com/u/2680978?v=4)](https://github.com/nachtsheim "nachtsheim (2 commits)")[![rgroli](https://avatars.githubusercontent.com/u/1597394?v=4)](https://github.com/rgroli "rgroli (1 commits)")[![cscheibelhut](https://avatars.githubusercontent.com/u/109964007?v=4)](https://github.com/cscheibelhut "cscheibelhut (1 commits)")

---

Tags

hacktoberfestlaravelmiddleware

### Embed Badge

![Health badge](/badges/imi-laravel-transsid/health.svg)

```
[![Health](https://phpackages.com/badges/imi-laravel-transsid/health.svg)](https://phpackages.com/packages/imi-laravel-transsid)
```

###  Alternatives

[lukaskleinschmidt/kirby-types

Kirby Types

238.0k1](/packages/lukaskleinschmidt-kirby-types)[geosem42/filamentor

Filamentor - A flexible page builder for Laravel Filament

311.0k](/packages/geosem42-filamentor)

PHPackages © 2026

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