#59344·framework

Default session naming using 'snake' breaks session with non-alphanumeric APP_NAME value

Author: jofrysutantoCreated Mar 24, 2026Updated Jul 31, 2026

Laravel Version

13.1.1

PHP Version

8.5

Database Driver & Version

No response

Description

Since the change of session naming:

php
// From
Str::slug((string) env('APP_NAME', 'laravel'), '_').'_session';
// Into
Str::snake((string) env('APP_NAME', 'laravel')).'_session';

application without explicit session name (SESSION_COOKIE) will not have session persisted correctly. For example when a local or staging environment with APP_NAME value of [LOCAL] My Awesome App

The value that gets resolved:

php
echo Str::slug((string) '[LOCAL] My App') . '_session';  // local-my-app_session
echo Str::snake((string) '[LOCAL] My App') . '_session'  // [_l_o_c_a_l]_my_app_session

The latter seem to break session persistence

Steps To Reproduce

In .env, set the following value

APP_NAME="[LOCAL] My Awesome App"

Use default auth flow:

  • Login
  • Successfully logged in, user session is 'set'
  • Redirect to authenticated route (with auth middleware guard)
  • User session is lost, gets redirected back to login