Updated June 2026. Tested on Laravel 13 and PHP 8.4.
SQLite is the simplest database to use with Laravel. There is no server to install and no credentials to manage. The whole database is a single file on disk, which makes it perfect for small apps, prototypes and tests. In fact recent Laravel uses SQLite as the default out of the box.
Create the database file
SQLite stores everything in one file. Create an empty one in the conventional location.
touch database/database.sqlite
Point the .env at it
Because there is no host or login, the .env is short. Give the absolute path to the file, or leave DB_DATABASE out and Laravel uses database/database.sqlite by default.
DB_CONNECTION=sqlite
DB_DATABASE=/absolute/path/to/database/database.sqlite
The connection in config/database.php
The sqlite connection is already defined.
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
Enable the extension
SQLite needs PHP's pdo_sqlite extension, which is usually on by default. Confirm it.
php -m | grep pdo_sqlite
The foreign key note to watch
One thing trips people up. SQLite does not enforce foreign keys unless you tell it to, and Laravel controls this with the foreign_key_constraints option above. It defaults to on, which is what you want, so cascading deletes and foreign keys behave like they do on MySQL. If you ever see foreign keys being ignored on SQLite, that setting is the first place to look.
Test it
php artisan migrate
Your tables are created right inside the file. Questions welcome in the comments.
All comments ()
No comments yet
Be the first to leave a comment on this post.