$ cat enabling-wal-mode-with-sqlite-in-laravel.md
Enabling WAL mode with SQLite in Laravel
Learn how to switch an SQLite database in Laravel to WAL (Write-ahead Logging) mode. The article shows the one config change needed in database.php, the journal_mode setting, and explains how WAL writes changes to a separate log file so writes don't block reads.
ryangjchandler.co.uk07 Aug 2025 · 1 min read · summary
Read on ryangjchandler.co.uk ↗SQLite's WAL (Write-ahead Logging) mode improves the reliability and performance of SQLite databases by changing where data is written to.
Instead of writing changes directly to the database.sqlite file, they instead get written to a separate log file first. That log file then gets merged into the main file in one go, allowing you to write without blocking reads from the database.
It's really easy to enable this mode in Laravel!
You just need to update the journal_mode configuration value for SQLite databases inside of the database.php config file, setting it to WAL.
return [
//...
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => 'WAL',
'synchronous' => null,
],
// ...
],
];
When Laravel creates the SQLite database connection, it will run PRAGMA journal_mode=WAL and all of your database writes will use the separate log file instead.
source
This is a summary of an article first published by ryangjchandler.co.uk. The full piece is on their site.