Download the PHP package satur.io/duckdb without Composer

On this page you can find all versions of the php package satur.io/duckdb. 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 duckdb

DuckDB API for PHP

Github Actions Badge Github Actions Badge Quality Gate Status Coverage Packagist Version DuckDB C API Version

This package provides a DuckDB Client API for PHP.

Focused on performance, it uses the official C API internally through FFI, achieving good benchmarks. This library is more than just a wrapper for the C API; it introduces custom, PHP-friendly methods to simplify working with DuckDB. It is compatible with Linux, Windows, and macOS, requiring PHP version 8.3 or higher.

Install

Documentation

Full documentation is available in https://duckdb-php.readthedocs.io/.

Quick Start

It's that simple! :duck:

The function we used here, DuckDB::sql(), performs the query in a new in-memory database which is destroyed after retrieving the result.

This is not the most common use case, let's see how to get a persistent connection.

Connection

As you probably guessed, DuckDB::create() creates a new connection to the specified database, or create a new one if it doesn't exist yet and then establishes the connection.

After that, we can use the function query to perform the requests.

[!WARNING] Notice the difference between the static method sql and the non-static method query. While the first one always creates and destroys a new in-memory database, the second one uses a previously established connection and should be the preferred option in most cases.

In addition, the library also provides prepared statements for binding parameters to our query.

Prepared Statements

Appenders

Appenders are the preferred method to load data in DuckDB. See DuckDB docs for more information.

DuckDB powerful

DuckDB provides some amazing features. For example, you can query remote files directly.

Let's use an aggregate function to calculate the average of a column for a parquet remote file:

Or summarize a remote csv:

I would recommend taking a look at the DuckDB documentation to figure out all possibilities.

[!TIP] Do you want more use cases? Check the examples folder.

Requirements

Recommended

Type Support

From version 1.2.0 on the library supports all DuckDB file types.

DuckDB Type SQL Type PHP Type
DUCKDB_TYPE_BOOLEAN BOOLEAN bool
DUCKDB_TYPE_TINYINT TINYINT int
DUCKDB_TYPE_SMALLINT SMALLINT int
DUCKDB_TYPE_INTEGER INTEGER int
DUCKDB_TYPE_BIGINT BIGINT int
DUCKDB_TYPE_UTINYINT UTINYINT int
DUCKDB_TYPE_USMALLINT USMALLINT int
DUCKDB_TYPE_UINTEGER UINTEGER int
DUCKDB_TYPE_UBIGINT UBIGINT Saturio\DuckDB\Type\Math\LongInteger
DUCKDB_TYPE_FLOAT FLOAT float
DUCKDB_TYPE_DOUBLE DOUBLE float
DUCKDB_TYPE_TIMESTAMP TIMESTAMP Saturio\DuckDB\Type\Timestamp
DUCKDB_TYPE_DATE DATE Saturio\DuckDB\Type\Date
DUCKDB_TYPE_TIME TIME Saturio\DuckDB\Type\Time
DUCKDB_TYPE_INTERVAL INTERVAL Saturio\DuckDB\Type\Interval
DUCKDB_TYPE_HUGEINT HUGEINT Saturio\DuckDB\Type\Math\LongInteger
DUCKDB_TYPE_UHUGEINT UHUGEINT Saturio\DuckDB\Type\Math\LongInteger
DUCKDB_TYPE_VARCHAR VARCHAR string
DUCKDB_TYPE_BLOB BLOB Saturio\DuckDB\Type\Blob
DUCKDB_TYPE_TIMESTAMP_S TIMESTAMP_S Saturio\DuckDB\Type\Timestamp
DUCKDB_TYPE_TIMESTAMP_MS TIMESTAMP_MS Saturio\DuckDB\Type\Timestamp
DUCKDB_TYPE_TIMESTAMP_NS TIMESTAMP_NS Saturio\DuckDB\Type\Timestamp
DUCKDB_TYPE_UUID UUID Saturio\DuckDB\Type\UUID
DUCKDB_TYPE_TIME_TZ TIMETZ Saturio\DuckDB\Type\Time
DUCKDB_TYPE_TIMESTAMP_TZ TIMESTAMPTZ Saturio\DuckDB\Type\Timestamp
DUCKDB_TYPE_DECIMAL DECIMAL float
DUCKDB_TYPE_ENUM ENUM string
DUCKDB_TYPE_LIST LIST array
DUCKDB_TYPE_STRUCT STRUCT array
DUCKDB_TYPE_ARRAY ARRAY array
DUCKDB_TYPE_MAP MAP array
DUCKDB_TYPE_UNION UNION mixed
DUCKDB_TYPE_BIT BIT string
DUCKDB_TYPE_VARINT VARINT string
DUCKDB_TYPE_SQLNULL NULL null

Other PHP DuckDB Integrations

This project takes inspiration from thbley/php-duckdb-integration and kambo-1st/duckdb-php. Without these prior works, satur-io/duckdb-php might not exist.

However, there are some key differences:

Contributions Are Welcome

There are several open issues you can contribute to. Feel free to create new issues for feature requests or bug reports. Contributions of any kind are highly appreciated!

If you'd like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Commit your changes with clear and concise messages.
  4. Submit a pull request with a detailed description of your changes.

[!NOTE] Please include tests for any new functionality or bug fixing.

Thank you for helping improve this project!

Buy Me a Coffee at ko-fi.com


All versions of duckdb with dependencies

PHP Build Version
Package Version
Requires ext-ffi 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 satur.io/duckdb contains the following files

Loading the files please wait ....