eznix86 / laravel-sqlite
Optimize SQLite for Laravel
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 1
pkg:composer/eznix86/laravel-sqlite
Requires
- php: ^8.4
Requires (Dev)
- driftingly/rector-laravel: ^2.1
- larastan/larastan: ^3.9
- laravel/pint: ^1.27
- mrpunyapal/rector-pest: ^0.1.9
- orchestra/testbench: ^10.9
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/phpstan: ^2.1
- rector/rector: ^2.3
This package is auto-updated.
Last update: 2026-02-20 21:30:09 UTC
README
Optimize SQLite for Laravel in production.
This package exists to give SQLite-first Laravel apps explicit control over performance PRAGMAs, maintenance commands, and migration-time file behavior.
Features
- Multi SQLite Connection Support
- Configurable SQLite PRAGMAs
- Supports Litestream Package
- Handles migration command startup to prepare missing SQLite files/directories.
Requirements
- PHP
^8.4 - Laravel
12.x(package is built/tested against the Laravel 12 ecosystem)
Installation
composer require eznix86/laravel-sqlite
Publish the config file:
php artisan vendor:publish --tag=sqlite-config
Configuration
Configuration lives in config/sqlite.php.
Key options:
sqlite.enabled- enable/disable package PRAGMA application.sqlite.litestream- Litestream-safe mode (forceswal_autocheckpoint=0).sqlite.pragmas.incremental_vacuumsqlite.pragmas.temp_storesqlite.pragmas.cache_size_mbsqlite.pragmas.mmap_size_mbsqlite.pragmas.wal_autocheckpoint
Environment variable prefix: SQLITE_...
Commands
Vacuum
Run full VACUUM on SQLite connections:
php artisan sqlite:vacuum php artisan sqlite:vacuum --connection=sqlite
Notes:
- Without
--connection, it runs on all configured SQLite connections. - If
sqlite.litestream=true, the command is blocked by design.
Show PRAGMAs
Display configuration and runtime PRAGMA values:
php artisan sqlite:show-pragmas php artisan sqlite:show-pragmas sqlite
Manually Cache / Clear PRAGMA SQL
php artisan sqlite:cache-pragmas php artisan sqlite:clear-pragmas-cache
These are also connected to Laravel optimize commands:
php artisan optimize-> caches PRAGMA SQLphp artisan optimize:clear-> clears PRAGMA SQL cache
Migration Behavior
The package listens for commands and prepares SQLite file connections automatically:
- For
migrate*anddb:wipe: ensures database files/directories exist (except:memory:). - For
migrate:fresh: removes the SQLite file and sidecars (-wal,-shm,-journal) first, then recreates the database file. - If
--database=...is provided, only that SQLite connection is targeted.
Litestream Support
If you want to back up and replicate your SQLite database with Litestream.
Use eznix86/laravel-litestream:
- GitHub: https://github.com/eznix86/laravel-litestream
- Packagist: https://packagist.org/packages/eznix86/laravel-litestream
Development
composer test:types
composer refactor
composer lint
composer lint:fix
composer test
Notes:
- This package currently uses feature-style tests; there is no dedicated
test:unitscript.
License
MIT
