PHPackages                             datadistillr/drill-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. datadistillr/drill-sdk-php

ActiveLibrary[Database &amp; ORM](/categories/database)

datadistillr/drill-sdk-php
==========================

PHP SDK for programmatically connecting to Apache Drill.

v0.7.17(3y ago)01.0kApache-2.0PHPPHP ^8.1

Since Mar 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/datadistillr/drill-sdk-php)[ Packagist](https://packagist.org/packages/datadistillr/drill-sdk-php)[ Docs](https://datadistillr.com)[ RSS](/packages/datadistillr-drill-sdk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (29)Used By (0)

[![Php_version](https://camo.githubusercontent.com/2f6c9133ac590968fc71c1f63f2f6286725ff0d236277653f69cbfef9667ce15/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6461746164697374696c6c722f6472696c6c2d73646b2d7068703f6c6f676f3d706870266c6f676f436f6c6f723d666666666666)](https://packagist.org/packages/datadistillr/drill-sdk-php)[![Package version](https://camo.githubusercontent.com/2d40d181f614f40f1babfda623382693f2e7d97e9f47fd0f04fef126a5826d87/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461746164697374696c6c722f6472696c6c2d73646b2d7068703f696e636c7564655f70726572656c6561736573266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d666666666666)](https://packagist.org/packages/datadistillr/drill-sdk-php)[![Slack](https://camo.githubusercontent.com/5d2619b1a3ff218cdfc2d077cd4da4dfa00937c7f4ce69422fcfc85cffa22051/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736c61636b2d2532336461746164697374696c6c72636f6d6d756e6974792d626c75653f6c6f676f3d736c61636b266c6f676f436f6c6f723d666666666666)](https://symfony.com/slack-invite)[![License](https://camo.githubusercontent.com/f168e0ef36fc62cec97760df38a061198775a116b0c04a33453b9d119a0acb13/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6461746164697374696c6c722f6472696c6c2d73646b2d7068703f6c6f676f3d617061636865266c6f676f436f6c6f723d666666666666)](LICENSE)

PHP SDK Library for Connecting to Apache Drill.
===============================================

[](#php-sdk-library-for-connecting-to-apache-drill)

This library allows you to connect to and query Apache Drill programmatically. It is loosely modeled after PHP's mysql interface, so if you are familiar with that, you already pretty much know how to use the Drill connector.

Installing the Library
----------------------

[](#installing-the-library)

This library can be installed using [Composer](https://getcomposer.org) by using the following command:

```
composer require "datadistillr/drill-sdk-php:^0.7.17"

```

The current pre-release version is: `0.7.17`

Using the Connector
-------------------

[](#using-the-connector)

The first step is to make a Drill connection handle. The module uses Drill's RESTful interface, so it will not maintain an open connection like a typical JDBC/ODBC connection would.

```
$drillHandle = new DrillConnection( 'localhost', 8047 );
```

You can use the `is_active()` menthod to verify that your connection is active.

```
if( $drillHandle->is_active() ) {
    print( "Connection Active" );
} else {
    print( "Connection Inactive" );
}
```

Querying Drill
--------------

[](#querying-drill)

Now that you've created your Drill connection handle, you can query Drill in a similar fashion as MySQL by calling the `query()` method. Once you've called the `query()` method, you can use one of the `fetch()` methods to retrieve the results, in a similar manner as MySQL. Currently, the Drill connector currently has:

- **`fetchAll()`**: Returns all query results in an associative array.
- **`fetchAssoc()`**: Returns a single query row as an associative array.
- **`fetchObject()`**: Returns a single row as a PHP Object.

You might also find these functions useful:

- **`dataSeek($n)`**: Returns the row at index `$n` and sets the current row to `$n`.
- **`numEows()`**: Returns the number of rows returned by the query.
- **`fieldCount()`**: Returns the number of columns returned by the query.

Thus, if you want to execute a query in Drill, you can do so as follows:

```
$query_result = $drillHandle->query( "SELECT * FROM cp.`employee.json` LIMIT 20" );
while( $row = $query_result->fetch_assoc() ) {
    print( "Field 1: {$row['field1']}\n" );
    print( "Field 2: {$row['field2']}\n" );
}
```

Interacting with Drill
----------------------

[](#interacting-with-drill)

You can also use the connector to activate/deactivate Drill's storage as well as get information about Drill's plugins.

- **`disablePlugin( $plugin )`** Disables the given plugin. Returns true if successful, false if not.
- **`enablePlugin( $plugin )`** Enables the given plugin. Returns true if successful, false if not.
- **`getAllStoragePlugins()`** Returns an array of all storage plugins.
- **`getDisabledStoragePlugins()`** Returns an array of all disabled plugins.
- **`getEnabledStoragePlugins()`** Returns an array of all enabled plugins.
- **`getStoragePlugins()`** Returns an associative array of plugins and associated configuration options for all plugins.
- **`getStoragePluginInfo( $plugin )`** Returns an associative array of configuration options for a given plugin.
- **`saveStoragePlugin( $plugin_name, $config )`** Creates or edits a storage plugin. Returns true if successful, throws exception if not.
- **`deleteStoragePlugin( $plugin_name )`** Deletes a storage plugin. Returns true if successful, throws exception if not.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 78% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~75 days

Recently: every ~41 days

Total

26

Last Release

1097d ago

PHP version history (3 changes)v0.1.0PHP ^5.3 | ^7.0

v0.2.0PHP ^7.4||^8.0

v0.7.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/819ac959f1249755c730359f686ff5efbf905f4b76f29dcfafa134395135011f?d=identicon)[datadistillr](/maintainers/datadistillr)

---

Top Contributors

[![tswagger](https://avatars.githubusercontent.com/u/8365904?v=4)](https://github.com/tswagger "tswagger (145 commits)")[![cgivre](https://avatars.githubusercontent.com/u/5513150?v=4)](https://github.com/cgivre "cgivre (34 commits)")[![jacobwiley](https://avatars.githubusercontent.com/u/8050802?v=4)](https://github.com/jacobwiley "jacobwiley (6 commits)")[![never2ice](https://avatars.githubusercontent.com/u/8060436?v=4)](https://github.com/never2ice "never2ice (1 commits)")

---

Tags

databasesqlviewsdata-analysisdata sciencebig-dataDrilldata explorationApache DrillDataDistillrDataDistiller

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/datadistillr-drill-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/datadistillr-drill-sdk-php/health.svg)](https://phpackages.com/packages/datadistillr-drill-sdk-php)
```

###  Alternatives

[thedataist/drill-connector

Objects that allow you to programmatically connect to Apache Drill.

118.7k1](/packages/thedataist-drill-connector)[paragonie/easydb

Easy-to-use database abstraction

744273.4k23](/packages/paragonie-easydb)[archon/dataframe

Archon: PHP Data Analysis Library

9824.2k1](/packages/archon-dataframe)[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

64401.8k10](/packages/rah-danpu)[calebdw/laravel-sql-entities

Manage SQL entities in Laravel with ease.

301.3k](/packages/calebdw-laravel-sql-entities)[mammothphp/woollym

WoollyM: PHP Data Analysis Library

111.6k](/packages/mammothphp-woollym)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
