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
Laravel Duckdb

Laravel Duckdb Laravel Package

thomas-0816/laravel-duckdb

View on GitHub
Deep Wiki
Context7

Laravel Eloquent driver for DuckDB, powered by the PHP PDO Driver for DuckDB, modern analytics

Frequently asked questions about Laravel Duckdb
How do I install the laravel-duckdb package?
Install the native PDO driver first with pie install thomas-0816/pdo-duckdb-php, then run composer require thomas-0816/laravel-duckdb in your Laravel application. After Composer finishes, run php artisan package:discover so Laravel registers the driver. You then add a duckdb connection in config/database.php. The package requires PHP 8.2 or newer, Laravel 12 or newer, and the pdo_duckdb extension.
Does laravel-duckdb support Laravel 12 and PHP 8.2?
Yes. The documented requirements are PHP 8.2+ and Laravel 12+, along with the pdo_duckdb PHP extension. If you are on an older Laravel or PHP version, you should upgrade before installing. Check that PIE can install the native extension on your platform.
How do I configure a DuckDB connection in Laravel?
Add a connection under connections in config/database.php with driver set to duckdb and database pointing to your .duckdb file, for example database_path('analytics.duckdb'). You can pass DuckDB settings through the options key using PDO::DUCKDB_ATTR_CONFIG, such as TimeZone, threads, memory_limit, or access_mode. Then use that connection name in queries or set it on an Eloquent model.
Can I use an in-memory DuckDB database for Laravel tests?
Yes. Set the connection database value to :memory: to use DuckDB's special in-memory database, which the README recommends for testing or reading external files. This keeps test data out of a persistent database file. You can still pass PDO::DUCKDB_ATTR_CONFIG options such as TimeZone and memory settings.
Can I use Eloquent models with DuckDB?
The package is an Eloquent driver for DuckDB, so it plugs DuckDB into Laravel's Eloquent ORM and query builder. Configure the duckdb connection and point your model at it with the protected $connection property, or set it as the default connection. Standard Eloquent query building works through the driver, while advanced DuckDB-specific SQL may depend on DuckDB's SQL support.
How do I create tables on DuckDB with Laravel Schema Builder?
Use Laravel's Schema facade with your DuckDB connection, for example Schema::connection('duckdb')->create('events', function (Blueprint $table) { ... }). The package integrates DuckDB with Laravel's Schema Builder, so you can define tables and columns using familiar Blueprint calls. Run migrations against the duckdb connection or call Schema directly in setup code.
What DuckDB PDO options can I set in Laravel?
The README shows PDO::DUCKDB_ATTR_CONFIG as an array under the connection options. Supported examples include TimeZone, threads for maximum threads, memory_limit such as 4GB, and access_mode set to read_only. These settings are passed to DuckDB when the PDO connection opens.
Does laravel-duckdb require PHP FFI or preloading?
No. It uses pdo_duckdb, a native C/C++ PHP extension that does not require PHP FFI or preloading. The release packages include pre-compiled binaries for supported platforms and bundle DuckDB directly. The driver is described as thread safe and tested with FrankenPHP PHP-ZTS.
Can I open a DuckDB database read-only or limit its resources?
Yes. In the connection options you can set access_mode to read_only to open the database file read-only. You can also set threads to cap DuckDB's worker threads and memory_limit to limit memory usage, for example 4GB. These are DuckDB configuration values passed through PDO::DUCKDB_ATTR_CONFIG.
Is DuckDB a good alternative to MySQL or SQLite for Laravel analytics?
DuckDB is an analytical database engine, so it is a strong fit for reporting, aggregations, and fast analytical queries inside a Laravel app. It is not intended to replace MySQL or PostgreSQL for high-concurrency transactional workloads. SQLite is simpler for small local storage, while laravel-duckdb is aimed at developers who want DuckDB's columnar analytics through Eloquent.
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.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource