Download the PHP package thomas-0816/pdo-duckdb-php without Composer

On this page you can find all versions of the php package thomas-0816/pdo-duckdb-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pdo-duckdb-php

PHP PDO Driver for DuckDB

DuckDB is an embedded SQL database designed for high-performance analytics (OLAP).

pdo_duckdb is a native DuckDB database driver for the PHP Data Objects (PDO) interface.\ As a native PHP extension, it is implemented in C/C++ and does not require PHP FFI or preloading.\ Compared to FFI, pdo_duckdb offers much more performance and lower latency by processing query results and type conversions in C/C++. It is also thread safe and fully tested with FrankenPHP (PHP-ZTS) and Swoole.\ The release packages contain pre-compiled binaries for all supported platforms and DuckDB is directly included. DuckDB extensions work the same way as they do in DuckDB CLI.

This extension supports all DuckDB types: Text, Numeric, Date, Time, Interval, JSON, Array, Struct, Map, List, Tuple, Enum, Variant, Geometry, Union, Bitstring, Blob and Boolean.

Supported PHP versions (nts & zts): 8.2 8.3 8.4 8.5 8.6

Supported operating systems: Ubuntu 22.04/24.04/26.04, Debian 12/13, Fedora 42/43, AmazonLinux, openSUSE 16, Arch, Alma, Rocky, Alpine, Wolfi OS, Windows Server 2022/2025 (x64), macOS 14-26 (arm64)

Supported SAPIs: php-cli, php-fpm, FrankenPHP, TrueAsync, Swoole, mod_php

Support end: Ubuntu 22.04 (April 2027), Debian 12 (April 2027)

Install and setup with 🥧 PIE

Install and load on demand with 🥧 PIE

Install and setup with 🧟 FrankenPHP (Debian/Ubuntu)

Install and setup with Docker

Usage examples

Open databases from disk or in-memory

Read and write Parquet files

Apache Parquet: very fast and efficient column based storage file format containing one table of data.\ Each column is split into several column groups. Depending on the query, the file can be read partially by certain columns groups.\ Different compression or dictionary algorithms can be applied to each column. Also supports encryption.

Note: You can read and save Parquet files on local file systems or directly on S3 object storage.

Read CSV files with SQL

CSV data import

Read JSON files with SQL

Read and write Excel files

Use structured columns with a fixed schema

Vector Similarity Search (HNSW)

Views

Transactions

Cast array columns to JSON-string

Auto increment columns

Differences to MySQL / MariaDB

Copy data from MySQL or MariaDB to Parquet

Start MariaDB container, create and fill "orders" table:

Use DuckDB MySQL extension to copy "orders" table from MariaDB to a parquet file:

Copy data from PostgreSQL to Parquet

Start PostgreSQL container, create and fill "orders" table:

Use DuckDB PostgreSQL extension to copy "orders" table from PostgreSQL to a parquet file:

Read public data using HTTPs, JSON, CSV and Parquet

Query weather data:

Download and query historical data from Deutsche Bahn:

Read private data using REST APIs

See the documentation for managing secrets and read_json().

Community extensions

open_prompt integrates LLMs into your SQL queries:

More extensions: List of Core Extensions, List of Community Extensions

Note: Community extensions are third party projects, NOT maintained or reviewed by the DuckDB team.

Performance

DuckDB is extremely fast when it comes to analytic queries.\ Here is an example with 10M rows, performing in 170ms on 4 threads with 128M ram:

Security

Use SQL SET variable = value; or put the settings inside the PDO::DUCKDB_ATTR_CONFIG connection options array:

A complete list is available in the DuckDB documentation: Securing DuckDB.

Alternatively, you can run SQL statements when the connection is estabilshed using PDO::DUCKDB_ATTR_INIT_COMMAND:

Compile NTS

Compile ZTS

Install with Swoole

Swoole example

Learn more about concurrency in DuckDB.

Compile with PHP TrueAsync

Why DuckDB?

https://duckdb.org/why_duckdb

Like SQLite, DuckDB embeds directly into host applications as a library, eliminating the need for network serialization and separate server setups. It uses columnar storage and vectorized processing, running analytics 10–100x faster than traditional row-oriented databases. DuckDB spills data to disk if needed, allowing to process datasets much larger than available system RAM. It includes an advanced query optimizer that handles joins, subqueries, expressions and filters.\ DuckDB can directly query flat files (JSON, CSV, and Parquet) directly via SQL without needing to import the data first. Flat files can be read directly from disk, network attached storage or S3 comatible cloud storage.\ Data is processed in cache-friendly batches on a multi-core architecture, allowing modern hardware to operate on arrays of data simultaneously. For analytical queries that only require a few metrics, DuckDB reads only the relevant columns from disk/memory, saving I/O and CPU cycles. This brings data warehouse-level performance to any laptop or server.

FAQ

Do I need an extra server for DuckDB?

No. DuckDB runs completely embedded inside of PHP as an extension, just like SQLite.

How much RAM and CPU do I need for DuckDB?

DuckDB normally runs good with 1-4 GB RAM and 2-4 CPU cores.

How good is the compression with Parquet and zstd?

For logs you normally achieve compression rates of 50-100x.

Who is maintaining DuckDB?

The DuckDB project is owned and maintained by the DuckDB Foundation, a non-profit organization from Amsterdam.

Can I get support for DuckDB?

Yes. Support is available on GitHub, see the community support page for details.

Is the PHP PDO Driver for DuckDB developed by the DuckDB project?

No. This is a third-party open-source community project.

Is DuckDB fully open-source?

Yes. DuckDB and all components are fully open-source under the MIT license.

Development

Laravel / Symfony

AI Disclosure

The C code is written by AI, the tests are written without AI.

License

MIT License


All versions of pdo-duckdb-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-pdo Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package thomas-0816/pdo-duckdb-php contains the following files

Loading the files please wait ...