'printing all running session variable in laravel 5.1

How do I print all running session variable in Laravel 5.1?

I want to print all the running session variable. Currently I can retrieve single running session for given value but don't know the function for print all at one time with one function something like

{{ Session::get(all)}}


Solution 1:[1]

If you just want to see contents of session, try dd():

dd(session()->all());

If not, just use this to get all info:

$data = session()->all();

More on this here.

Solution 2:[2]

You can also use dd(Session::all());

Solution 3:[3]

you can display sessions contents as :

$sessions=session()->all();

or

$sessions=Session::all();

to print contents use :

foreach($sessions as $k=>$v){
    echo $k."=".$v." ";
}
//or use : 
dd(session()->all()) ; // this is  var_dump equeivelent

to use specific session key :

$user_id = session('user_id'); // key : user_id

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Harry Bosh
Solution 3 user2448808