eznix86/laravel-sqlite 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eznix86/laravel-sqlite

最新稳定版本:v2.0.0

Composer 安装命令:

composer require eznix86/laravel-sqlite

包简介

Optimize SQLite for Laravel

README 文档

README

Optimize SQLite Banner

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.3
  • Laravel 13.x >= v2.0.0
  • Laravel 12.x <= v2.0.0

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 (forces wal_autocheckpoint=0).
  • sqlite.pragmas.incremental_vacuum
  • sqlite.pragmas.temp_store
  • sqlite.pragmas.cache_size_mb
  • sqlite.pragmas.mmap_size_mb
  • sqlite.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 SQL
  • php artisan optimize:clear -> clears PRAGMA SQL cache

Migration Behavior

The package listens for commands and prepares SQLite file connections automatically:

  • For migrate* and db: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:

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:unit script.

License

MIT

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固