# Delete Expired Sessions in Laravel With a Scheduled Command

DevFeed: [Delete Expired Sessions in Laravel With a Scheduled Command](<https://devfeed.tech/articles/delete-expired-sessions-in-laravel-with-a-scheduled-command-109813.md>)

Original publisher: [Read original article](<https://laravel-news.com/laravel-delete-expired-sessions>)

Author: Paul Redmond

Published: 2026-10-29T23:07:33Z

Content type: tutorial

Language: en

Sources: [Laravel](<https://devfeed.tech/sources/laravel.md>)

Topics: [Laravel](<https://devfeed.tech/topics/laravel.md>), [sessions](<https://devfeed.tech/topics/sessions.md>)

Tags: [cleanup](<https://devfeed.tech/tags/cleanup.md>), [command](<https://devfeed.tech/tags/command.md>), [database](<https://devfeed.tech/tags/database.md>), [delete](<https://devfeed.tech/tags/delete.md>), [file](<https://devfeed.tech/tags/file.md>), [laravel](<https://devfeed.tech/tags/laravel.md>), [laravel-tutorials](<https://devfeed.tech/tags/laravel-tutorials.md>), [lottery](<https://devfeed.tech/tags/lottery.md>), [scheduled](<https://devfeed.tech/tags/scheduled.md>), [sessions](<https://devfeed.tech/tags/sessions.md>)

## AI overview

For Laravel 13.39 or later, apps using the `database` or `file` session driver can schedule `session:garbage-collect` to remove expired sessions, then set the session lottery to `[0, 100]` so web requests no longer run cleanup. The command uses the default driver and `session.lifetime`, reports success but not the deletion count, and does nothing for cache-based drivers. `redis`, `memcached`, `dynamodb`, `apc`, and `cookie` drivers expire sessions without cleanup. For database sessions on multiple servers, use `onOneServer()` with a shared cache lock; file sessions require running cleanup on each server unless their directory is shared. On Laravel 13.38 and earlier, schedule a closure calling the handler's `gc()` method, converting lifetime minutes to seconds; named closures are required for `onOneServer()`. The article says hourly cleanup suits the default 120-minute lifetime.

## Source excerpt

Schedule session:garbage-collect to delete expired Laravel database and file sessions, and turn off the session lottery that runs cleanup in web requests. The post Delete Expired Sessions in Laravel With a Scheduled Command appeared first on Laravel News. Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.