PHPackages                             gajus/drill - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. gajus/drill

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

gajus/drill
===========

Mandrill API interface with no bells and whistles.

0.0.3(11y ago)61773BSD-3-ClausePHPPHP &gt;=5.3

Since Aug 26Pushed 10y ago1 watchersCompare

[ Source](https://github.com/gajus/drill)[ Packagist](https://packagist.org/packages/gajus/drill)[ Docs](https://github.com/gajus/drill)[ RSS](/packages/gajus-drill/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Drill
=====

[](#drill)

[![Build Status](https://camo.githubusercontent.com/48a35a9bdf61971396c9914efdfb8bfbaca0b66afbc469c90b42f832d7bbd3c3/68747470733a2f2f7472617669732d63692e6f72672f67616a75732f6472696c6c2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/gajus/drill)[![Coverage Status](https://camo.githubusercontent.com/5609a586ada6f874a19ff32e1af88a6b589ba17a7dc42e34281030437019ec3b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f67616a75732f6472696c6c2f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/gajus/drill?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/e1c5f73578aa8ba268084bc7046550b6c164365df99852ec4b7d6c24f75384bf/68747470733a2f2f706f7365722e707567782e6f72672f67616a75732f6472696c6c2f76657273696f6e2e706e67)](https://packagist.org/packages/gajus/drill)[![License](https://camo.githubusercontent.com/fa306051d04be30805426666cc27e789ad6ce33f99da322a922cf251730fa6f3/68747470733a2f2f706f7365722e707567782e6f72672f67616a75732f6472696c6c2f6c6963656e73652e706e67)](https://packagist.org/packages/gajus/drill)

[Mandrill API](https://mandrillapp.com/api/docs/) interface with no bells and whistles.

Drill `Client` implementation makes no assumptions about the underlying API schema or required parameters. However, it will throw an exception when you do not provide the required parameters based on the response. Therefore, it is not an abstraction that will prevent your code from braking if/when Mandrill API changes. It is used to interact with the API endpoint and handle errors. That said, Mandrill RESTful API implements versioning, which ought to prevent breaking code that is using Drill implementation when API changes occur.

The only provided method is `api`

```
/**
 * @param string $key Mandrill API key.
 */
$drill = new \Gajus\Drill\Client('NlLdhX5FVKS55VBK1xPW_g');

/**
 * @see https://mandrillapp.com/api/docs/messages.JSON.html
 * @param string $path
 * @param array $parameters
 */
$response = $drill->api('messages/send', [
    'message' => [
        'text' => 'Test',
        'subject' => 'test',
        'from_email' => 'dummy@gajus.com',
        'to' => [
            ['email' => 'dummy@gajus.com']
        ],
    ]
]);
```

Mandrill response is converted to an associative array:

```
array(1) {
  [0]=>
  array(4) {
    ["email"]=>
    string(15) "dummy@gajus.com"
    ["status"]=>
    string(4) "sent"
    ["_id"]=>
    string(32) "f65f65c266f74e2884344ccfff3bb337"
    ["reject_reason"]=>
    NULL
  }
}
```

Handling errors
---------------

[](#handling-errors)

Cases that can be caught before making a request to the API or rules that are enforced by Drill implementation, as opposed to the API spec, will throw `Gajus\Drill\Exception\InvalidArgumentException`.

All errors that occur during the runtime will result in `Gajus\Drill\Exception\ErrorException`.

Beware that errors returned from Mandrill API have inconsistent naming convention (CamelCase vs underscore, e.g. "UserError", "Invalid\_Key"). Drill will cast all errors to CamelCase convention (e.g. "Invalid\_Key" becomes "InvalidKeyException").

```
$drill = new \Gajus\Drill\Client('fxBTBjWKxJ05K9MjkFak1A');

try {
  $response = $drill->api('messages/send', [
      'message' => [
          'text' => 'Test',
          'subject' => 'test',
          'from_email' => 'invalidemail',
          'to' => [
              ['email' => 'dummy@gajus.com']
          ],
      ]
  ]);
} catch (\Gajus\Drill\Exception\RuntimeException\ValidationErrorException $e) {
    // @see https://mandrillapp.com/api/docs/messages.html
} catch (\Gajus\Drill\Exception\RuntimeException\UserErrorException $e) {
    // @see https://mandrillapp.com/api/docs/messages.html
} catch (\Gajus\Drill\Exception\RuntimeException\UnknownSubaccountException $e) {
    // @see https://mandrillapp.com/api/docs/messages.html
} catch (\Gajus\Drill\Exception\RuntimeException\PaymentRequiredException $e) {
    // @see https://mandrillapp.com/api/docs/messages.html
} catch (\Gajus\Drill\Exception\RuntimeException\GeneralErrorException $e) {
    // @see https://mandrillapp.com/api/docs/messages.html
} catch (\Gajus\Drill\Exception\RuntimeException\ValidationErrorException $e) {
    // @see https://mandrillapp.com/api/docs/messages.html
} catch (\Gajus\Drill\Exception\RuntimeException $e) {
    // All possible API errors.
} catch (\Gajus\Drill\Exception\InvalidArgumentException $e) {
    // Invalid SDK use errors.
} catch (\Gajus\Drill\Exception\DrillException $e) {
    // Everything.
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.4% 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

Unknown

Total

1

Last Release

4279d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b46b18abe058b038c677a9fa4aa6c39de7597196fb72a11add1f11600412a0e5?d=identicon)[gajus](/maintainers/gajus)

---

Top Contributors

[![gajus](https://avatars.githubusercontent.com/u/973543?v=4)](https://github.com/gajus "gajus (27 commits)")[![mrsimonbennett](https://avatars.githubusercontent.com/u/1471305?v=4)](https://github.com/mrsimonbennett "mrsimonbennett (1 commits)")

---

Tags

emailmandrill

### Embed Badge

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

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

###  Alternatives

[slm/mail

Integration of various email service providers in the Laminas\\Mail

108732.4k1](/packages/slm-mail)[slot/mandrill-bundle

Symfony Mandrill Bundle

671.5M1](/packages/slot-mandrill-bundle)[omnimail/omnimail

PHP Library to send email across all platforms using one interface.

32934.3k](/packages/omnimail-omnimail)[nickcv/yii2-mandrill

Mandrill Api Integration for Yii2

29554.2k2](/packages/nickcv-yii2-mandrill)[swissup/module-email

Magento2 email providers integration (smtp, mandrill, amazon ses)

1412.8k1](/packages/swissup-module-email)

PHPackages © 2026

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