Artisan command for clearing all session data in Laravel

Yevgeniy Afanasyev picture Yevgeniy Afanasyev · Jun 7, 2018 · Viewed 46.6k times · Source

What is the artisan command for clearing all session data in Laravel, I'm looking for something like:

$ php artisan session:clear

But apparently it does not exist. How would I clear it from command line?

I tried using

$ php artisan tinker  
...
\Session::flush();

But it flushes session of only one user, I want to flush all sessions for all users. How can I do it?

I tried this:

artisan cache:clear

But it does not clear session, again.

Answer

mitra razmara picture mitra razmara · Dec 14, 2018

If you are using file based sessions, you can use the following linux command to clean the sessions folder out:

rm -f storage/framework/sessions/*