Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Database Sqlite

Database Sqlite Laravel Package

hyperf/database-sqlite

SQLite database adapter for Hyperf, integrating SQLite connections with hyperf/database for coroutine-based PHP apps. Easily configure lightweight local storage, testing, and small-scale persistence with familiar query builder and ORM support.

Deep Wiki
Context7

hyperf/database-sqlite adds SQLite support to Hyperf’s database component, enabling lightweight, file-based databases through the same connection, query builder, and schema APIs used by other Hyperf drivers. It provides the SQLite-specific connector, grammar, and processor needed for clean integration with Hyperf applications.

  • Seamless integration with hyperf/database
  • SQLite query and schema grammars
  • PDO-based connections for file or in-memory databases
  • Supports query builder and migration workflows
  • Ideal for testing, prototypes, and embedded storage
Frequently asked questions about Database Sqlite
What is hyperf/database-sqlite used for?
It provides the SQLite driver, connection handling, and query builder integration needed to run SQLite through Hyperf's database component. You use it when you want a simple file-based or in-memory database instead of a client-server engine like MySQL or PostgreSQL. Typical cases are small services, CLI tools, local development, and automated tests.
How do I install hyperf/database-sqlite?
Install it with Composer by running composer require hyperf/database-sqlite in your Hyperf application. Make sure the PDO SQLite extension is enabled in your PHP build, since the driver relies on it. After installation, add a sqlite connection to your database configuration.
How do I configure a SQLite connection in Hyperf?
Add an entry to config/autoload/databases.php with driver set to sqlite and database pointing to your file path, for example BASE_PATH . '/runtime/database.sqlite'. You can also read the path from an environment variable so local and production setups differ cleanly. The connection is then resolved through the standard Hyperf Db facade or injected DbInterface.
Can I use hyperf/database-sqlite in a Laravel application?
No. This package is built for Hyperf's coroutine-based framework, not Laravel; Laravel already ships SQLite support through its own database layer. The query builder API feels familiar because Hyperf's database component follows the same conventions, but the container, configuration, and lifecycle are Hyperf-specific. Use it only in Hyperf projects.
Does it support in-memory SQLite for testing?
Yes, you can point database at :memory: to get a fast, disposable database for tests. Keep in mind that an in-memory database lives only as long as its connection, so pooled or multiple connections each see their own empty database. For tests that need shared state across connections, use a temporary file path instead.
Which query builder features are available with SQLite?
You get the standard fluent builder: selects, joins, where clauses, aggregates, inserts, updates, deletes, and transactions. Coverage follows what SQLite itself supports, so features such as right joins or certain ALTER TABLE operations are limited by the engine. Raw expressions remain available when you need something SQLite-specific.
How do I create the SQLite database file and run migrations?
Create an empty file at the configured path, or let SQLite create it on first write if the directory is writable. Then use Hyperf's migration component to generate and run schema migrations as usual. Ensure the runtime directory exists and is writable by the process user before running migrations.
Does it work with Swoole connection pooling and coroutines?
Yes, the connection is resolved through Hyperf's database manager, so it participates in the usual pool configuration. Because SQLite allows only one writer at a time, heavy concurrent writes will serialize or raise busy errors. Enable WAL mode and keep write transactions short when you expect concurrency.
Is hyperf/database-sqlite suitable for production?
It is fine for read-heavy or low-write services, embedded persistence, and single-node deployments where a file database is acceptable. Watch out for write lock contention, file permissions, and the fact that the database file must be backed up and stored on reliable local disk. For high write throughput or multi-node setups, a client-server database is usually the better choice.
What are the alternatives to hyperf/database-sqlite?
The main alternatives are Hyperf's MySQL and PostgreSQL drivers, which use the same database component and query builder API. If you only need key-value style persistence, Hyperf's cache or a dedicated storage library may be simpler. Check the package's composer.json for its supported Hyperf and PHP version constraints before upgrading.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
vento/laravel-airbrake
wfeller/laravel-batch
maco-studios/mage-os-installer
busarm/armie
siberfx/laravel-logger
kfteam1991/dcat-admin
dashed/dashed-laposta
dashed/dashed-ecommerce-montaportal
dashed/dashed-ecommerce-etsy
neohq/string-blade-compiler
log1x/acf-composer
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager