PHPackages                             thedataist/drill-connector - 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. thedataist/drill-connector

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

thedataist/drill-connector
==========================

Objects that allow you to programmatically connect to Apache Drill.

v0.1.1(8y ago)118.7k↓33.3%5[1 PRs](https://github.com/cgivre/drill-php/pulls)1Apache-2.0PHPPHP ^5.3 | ^7.0

Since Mar 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/cgivre/drill-php)[ Packagist](https://packagist.org/packages/thedataist/drill-connector)[ Docs](http://thedataist.com)[ RSS](/packages/thedataist-drill-connector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (1)

PHP Library to Connect to Apache Drill.
=======================================

[](#php-library-to-connect-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 Connector
------------------------

[](#installing-the-connector)

The connector is on the Packageist () and can be installed by using composer as follows:

```
composer require thedataist/drill-connector:dev-master

```

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

[](#using-the-connector)

The first step is to connect to Drill. The module uses Drill's RESTful interface, so it doesn't really make a "connection" in the same sense as MySQL.

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

As mentioned earlier, this creates the object, but doesn't actually send anything to Drill. You can use the `is_active()` menthod to verify that your connection is active.

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

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

[](#querying-drill)

Now that you've connected to Drill, you can query drill in much a similar way 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:

- **`fetch_all()`**: Returns all query results in an associative array.
- **`fetch_assoc()`**: Returns a single query row as an associative array.
- **`fetch_object()`**: Returns a single row as a PHP Object.

You might also find these functions useful:

- **`data_seek($n)`**: Returns the row at index `$n` and sets the current row to `$n`.
- **`num_rows()`**: Returns the number of rows returned by the query.
- **`field_count()`**: 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 = $drill->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.

- **`disable_plugin( $plugin )`** Disables the given plugin. Returns true if successful, false if not.
- **`enable_plugin( $plugin )`** Enables the given plugin. Returns true if successful, false if not.
- **`get_all_storage_plugins()`** Returns an array of all storage plugins.
- **`get_disabled_storage_plugins()`** Returns an array of all disabled plugins.
- **`get_enabled_storage_plugins()`** Returns an array of all enabled plugins.
- **`get_storage_plugins()`** Returns an associative array of plugins and associated configuration options for all plugins.
- **`get_storage_plugin_info( $plugin )`** Returns an associative array of configuration options for a given plugin.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 65.2% 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 ~0 days

Total

2

Last Release

2983d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fd61faf3d7166a037b1cab866c10ff6053189db5ff2c29decda51df1a052f21?d=identicon)[cgivre](/maintainers/cgivre)

---

Top Contributors

[![cgivre](https://avatars.githubusercontent.com/u/5513150?v=4)](https://github.com/cgivre "cgivre (30 commits)")[![tswagger](https://avatars.githubusercontent.com/u/8365904?v=4)](https://github.com/tswagger "tswagger (16 commits)")

---

Tags

databasesqlviewsdata-analysisdata sciencebig-dataDrilldata explorationApache Drill

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thedataist-drill-connector/health.svg)

```
[![Health](https://phpackages.com/badges/thedataist-drill-connector/health.svg)](https://phpackages.com/packages/thedataist-drill-connector)
```

###  Alternatives

[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)[davmixcool/php-dbcloud

Easily backup PostgreSql or MySql database to the cloud

111.5k](/packages/davmixcool-php-dbcloud)

PHPackages © 2026

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